Subject: RE: [xsl] XML Group with XSL From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Wed, 21 Apr 2004 18:17:40 +0200 |
> -----Original Message----- > From: Patel, Viral [mailto:viral.patel@xxxxxxxxxxxxxxxxxxxx] > > You xsl should look something like: > Hi, The proposed solution won't yield the desired result. The result from your code would look something like <ROOT> <node_1 ...> <node_1 ...> <node_1 ...> </node_1> </ROOT> The intention was good, but it needs to be modified like: > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:fo="http://www.w3.org/1999/XSL/Format"> > > <xsl:template match="/"> > <xsl:text disable-output-escaping="yes"><?xml version="1.0" > encoding="ISO-8859-1"?></xsl:text> ??? Why are you explicitly inserting the XML declaration in this way? If you use <xsl:output method="XML" /> (which is the default BTW), the XML declaration will be added anyway, and so, if you subsequently use xsl:text to insert it again, the resulting XML document will be in error. So, remove the <xsl:text ...> !! If you really need 'ISO-8859-1' encoding for the result, just add the following as child of xsl:stylesheet : <xsl:output method="XML" encoding="ISO-8859-1" /> Apply templates only to the first node_1 node: > <ROOT> > <xsl:apply-templates select="ROOT/node_1[1]" /> > </ROOT> > And in the template matching the node_1 nodes, create a copy, then copy the attributes, and finally copy all children of the current node as well as the children of the other (following-sibling) node_1 nodes : <xsl:template match="node_1"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:copy-of select="* | following-sibling::node_1/*" /> </xsl:copy> </xsl:template> Hope this helps! Cheers, Andreas
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XML Group with XSL, Jeni Tennison | Thread | [xsl] XML Group with XSL, aalikaj |
Re: [xsl] Problem with xsl:if, David Carlisle | Date | Re: [xsl] Problem with xsl:if, Wendell Piez |
Month |