[ http://issues.apache.org/jira/browse/XALANJ-2005?page=all ]

Brian Minchau updated XALANJ-2005:
----------------------------------

    Fix Version: 2.7

> Xalan 2.6 with pipedocument swallows xsl:attribute
> --------------------------------------------------
>
>          Key: XALANJ-2005
>          URL: http://issues.apache.org/jira/browse/XALANJ-2005
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan-extensions
>     Versions: 2.6
>  Environment: Windows 2000
>     Reporter: Remiu Wremlokov
>     Priority: Critical
>      Fix For: 2.7

>
> While sending an XML input document through several XSL transformations and 
> stylesheets with the pipeDocument extension, <xsl:attribute> is only 
> preserved to the output when added at the last in the row of the stylesheets. 
> Otherwise <xsl:attribute> is ignored.
> file "input.xml"
> <root>
>     <a>
>         <b>b-text</b>
>         <c>c-text</c>
>         <d>d-text</d>
>     </a>
>     <a>
>         <b>b-text</b>
>         <c>c-text</c>
>         <d>d-text</d>
>     </a>
> </root>
> file "pipe.xsl"
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>                 xmlns:pipe="http://xml.apache.org/xalan/PipeDocument";
>                 extension-element-prefixes="pipe">
> <xsl:param name="source"/>
> <xsl:param name="target"/>
> <xsl:template match="/">
>   <pipe:pipeDocument source="{$source}"  target="{$target}">
>     <stylesheet href="first.xsl"/>
>     <stylesheet href="second.xsl"/>
>     <stylesheet href="third.xsl"/>
>   </pipe:pipeDocument>
>  
> </xsl:template>
> </xsl:stylesheet>
> "first.xsl"
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> version="1.0">
>   <xsl:template match="/ | @* | node()">
>     <xsl:copy>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
>   <xsl:template match="b">
>     <xsl:copy>
>       <xsl:attribute name="attr-first">1</xsl:attribute>
>       <xsl:element name="b-first">b-first-text</xsl:element>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>  
> file "second.xsl"
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> version="1.0">
>   <xsl:template match="/ | @* | node()">
>     <xsl:copy>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
>   <xsl:template match="c">
>     <xsl:copy>
>       <xsl:attribute name="attr-second">2</xsl:attribute>
>       <xsl:element name="c-second">c-second-text</xsl:element>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>  
> file "third.xsl"
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> version="1.0">
>   <xsl:template match="/ | @* | node()">
>     <xsl:copy>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
>   <xsl:template match="d">
>     <xsl:copy>
>       <xsl:attribute name="attr-third">3</xsl:attribute>
>       <xsl:element name="d-third">d-third-text</xsl:element>
>       <xsl:apply-templates />
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>  
> command line start:
> set 
> classpath=C:\c\projekte\xalan-xslt\lib\xalan.jar;C:\c\projekte\xalan-xslt\lib\bsf.jar
> %JAVA_HOME%\bin\java -cp "%classpath%" org.apache.xalan.xslt.Process  -in 
> input.xml -xsl pipe.xsl -param source input.xml -param target output.xml
> output file "output.xml".
> the additional elements c-first and d-second are expected as operating result 
> of first.xsl and second.xsl. But only third.xsl's additional attribute is 
> preserved. The added attributes of first.xsl and second.xsl have disappeared. 
> Remark: The same happens, if the pipe is shortened and third.xsl removed. 
> Then only second.xsl's created attribute appears.
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
>     <a>
>         <b><b-first>b-first-text</b-first>b-text</b>
>         <c><c-second>c-second-text</c-second>c-text</c>
>         <d attr-third="3"><d-third>d-third-text</d-third>d-text</d>
>     </a>
>     <a>
>         <b><b-first>b-first-text</b-first>b-text</b>
>         <c><c-second>c-second-text</c-second>c-text</c>
>         <d attr-third="3"><d-third>d-third-text</d-third>d-text</d>
>     </a>
> </root>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to