Subject: RE: 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 |
- XML Group with XSL
- aalikaj - Wed, 21 Apr 2004 11:35:23 -0400 (EDT)
- <Possible follow-ups>
- Patel, Viral - Wed, 21 Apr 2004 11:45:04 -0400 (EDT)
- Jeni Tennison - Wed, 21 Apr 2004 12:09:34 -0400 (EDT)
- Andreas L. Delmelle - Wed, 21 Apr 2004 12:10:57 -0400 (EDT) <=
- aalikaj - Wed, 21 Apr 2004 12:04:26 -0400 (EDT)
- aalikaj - Wed, 21 Apr 2004 12:53:44 -0400 (EDT)
- aalikaj - Wed, 21 Apr 2004 15:08:44 -0400 (EDT)
|
|