[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML Group with XSL

Subject: RE: XML Group with XSL
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Wed, 21 Apr 2004 18:17:40 +0200
group by xsl
> -----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">&lt;?xml version="1.0"
> encoding="ISO-8859-1"?&gt;</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)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.