You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Robert A. (Bob) Morris" <ra...@cs.umb.edu> on 2000/12/05 15:35:26 UTC

destructive select with xalan2?

Using xalan 2 and the xslt below, the first time the <xsl:copy-of/> is
called the correct element comes out, but on second call, nothing
comes out. This seems wrong to me, and also the expected behavior
happens with XMLSpy 3.0.7. Can someone illuminate this for me? I am
moderately convinced that my classpath is going through the correct
versions of xalan 2 and xerces java 2, but maybe somebody knows of old
behavior that would suggest this is wrong. In fact, every xsl element
that I tried seems to have the same issue. If I am wrong that the
second call is not entitled to be empty, I would welcome a a pointer
to the relevant place in the XSLT Recommendation.

Thanks
Bob Morris

----

XSL:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:template match="/">
    <xsl:variable name ="theNode" select="//inc/node4"/>
    <xsl:copy-of select="$theNode"/>
    <xsl:copy-of select="$theNode"/>
  </xsl:template>
</xsl:stylesheet>


Input:

<?xml version="1.0" encoding="UTF-8"?>
<inc>
  <list>
    <node1>foo1</node1>
    <node2>foo2</node2>
    <node3>foo3</node3>
  </list>
  <node1>bar1</node1>
  <node2>bar2</node2>
  <node4>bar4</node4>
</inc>


Processing:

/tools/jdk-1.3.0/usr/bin/java org.apache.xalan.xslt.Process  -in inc.xml -xsl inc.xsl -out inc.ans.xml


Output:

<?xml version="1.0" encoding="UTF-8"?>
<node4>bar4</node4>



Re: destructive select with xalan2?

Posted by Gary L Peskin <ga...@firstech.com>.
"Robert A. (Bob) Morris" wrote:
> 
> Using xalan 2 and the xslt below, the first time the <xsl:copy-of/> is
> called the correct element comes out, but on second call, nothing
> comes out. This seems wrong to me, and also the expected behavior
> happens with XMLSpy 3.0.7. Can someone illuminate this for me? I am
> moderately convinced that my classpath is going through the correct
> versions of xalan 2 and xerces java 2, but maybe somebody knows of old
> behavior that would suggest this is wrong. In fact, every xsl element
> that I tried seems to have the same issue. If I am wrong that the
> second call is not entitled to be empty, I would welcome a a pointer
> to the relevant place in the XSLT Recommendation.
> 
> Thanks
> Bob Morris

Bob --

On the latest XalanJ2 from CVS, the output that I get is:

<?xml version="1.0" encoding="UTF-8"?>
<node4>bar4</node4><node4>bar4</node4>

as you would expect.  I can only conclude that whatever was broken in
your release has since been fixed.

Gary