RE: Two implementations, different results

Subject: RE: Two implementations, different results
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Thu, 23 Sep 1999 13:43:50 -0700
I know we have a known issue when <xsl:copy-of>
is used on the root node.
The following works for me on both XT and oraxsl 2.0.2 :

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>
<xsl:variable name="source">
<Account>
  <Balance>1000</Balance>
</Account>
</xsl:variable>

<!-- Merge two <Accounts> by appending each Account -->

<xsl:template match="/">
   <Accounts>
       <xsl:apply-templates select="Account"/>
   </Accounts>
</xsl:template>

<xsl:template match="Account">
  <xsl:copy-of select="."/>
  <xsl:copy-of select="$source"/>
</xsl:template>

</xsl:stylesheet>

We have a known bug of producing the extraneous <root>
tag if you use <xsl:copy-of select="."/> on the root
node of the source document.
      
______________________________________________
Steve Muench
Consulting Product Manager & XML Evangelist
Business Components for Java Development Team 

| -----Original Message-----
| From: owner-xsl-list@xxxxxxxxxxxxxxxx
| [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Terris
| Sent: Thursday, September 23, 1999 12:27 PM
| To: xsl-list@xxxxxxxxxxxxxxxx
| Subject: Two implementations, different results
| 
| 
| With the attached document and style sheet, I get the following
| output with xt (http://www.jclark.com/xml/xt.html): (sansthe 
| namespace junk)
| 
| <Accounts>
| <Account>
|   <Balance>500</Balance>
| </Account>
| <Account>
|   <Balance>1000</Balance>
| </Account>
| </Accounts>
| 
| With the Oracle V2 parser (9/14 drop) I get:
| 
| <Accounts>
|    <root>
|       <Account>
|          <Balance>500</Balance>
|       </Account>
|    </root>
| </Accounts>
| 
| Which implementation is right?  What is <root> doing in Oracle's output?
| 
| 
| The document:
| 
| <Account>
|   <Balance>500</Balance>
| </Account>
| 
| The stylesheet:
| 
| <?xml version="1.0"?>
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>;
| 
| <xsl:output method="xml" indent="yes"/>
| 
| <xsl:variable name="source">
| <Account>
|   <Balance>1000</Balance>
| </Account>
| </xsl:variable>    <!--source of data-->
| 
| <!-- Merge two <Accounts> by appending each Account -->
| 
| <xsl:template match="/">
|    <Accounts>
|        <xsl:copy-of select="."/>
|                  <xsl:for-each select="document('')">
|            <xsl:copy-of select="//xsl:variable[@name
| = 'source']/*"/>
|        </xsl:for-each>
|    </Accounts>
| </xsl:template>
| 
| 
| </xsl:stylesheet>
| 
| 
| 
| 
| 
|  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread