Altova Mailing List ArchivesReformat XMLTo: NULL Date: 4/1/2005 12:02:00 PM This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C536B2.AD115500
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a situation where I am trying to reformat some XML but I do not =
want to use any XML document element name specific information as I am =
trying to write the XSL generically as possible. I have the following =
XML:
<root>
<node1/>
<node2/>
<node3/>
<node3/>
<node3/>
<node3/>
<node3/>
<node4/>
</root>
I want to recursively go throught the tree but when I get to node3 I =
want to place all of them inside a new collection node. I had thought I =
could create a template and pass it the selection of something like =
following-sibling::*[name(following-sibling::*) =3D name(.)] but that is =
not working. So the result I am looking for in my output would be:
<root>
<node1/>
<node2/>
<collection>
<node3/>
<node3/>
<node3/>
<node3/>
<node3/>
</collection>
<node4/>
</root>
If I hard code the value node3 in the equals it seems to work but that =
defeats my generic-ness of what I am trying to do. If anyone has any =
suggestions I would appreciate it.
Thanks,=20
Matt
------=_NextPart_000_0010_01C536B2.AD115500
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.3790.259" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I have a situation where I am trying to =
reformat=20
some XML but I do not want to use any XML document element name specific =
information as I am trying to write the XSL generically as =
possible. I=20
have the following XML:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><root></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node1/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node2/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node4/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></root></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I want to recursively go throught the =
tree but when=20
I get to node3 I want to place all of them inside a new collection =
node. I=20
had thought I could create a template and pass it the selection of =
something=20
like following-sibling::*[name(following-sibling::*) =3D name(.)] but =
that is not=20
working. So the result I am looking for in my output would=20
be:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2><root></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node1/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node2/></FONT></DIV>
<DIV> <collection></DIV>
<DIV><FONT face=3DArial size=3D2> =20
<node3/></FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
<node3/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
<node3/></FONT></DIV>
<DIV> </collection></DIV>
<DIV><FONT face=3DArial size=3D2> =
<node4/></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></root></FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> If I hard code the value node3 in =
the equals=20
it seems to work but that defeats my generic-ness of what I am trying to =
do. If anyone has any suggestions I would appreciate =
it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Matt</FONT></DIV></BODY></HTML>
------=_NextPart_000_0010_01C536B2.AD115500--
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
