[ http://nagoya.apache.org/jira/browse/XALANJ-1969?page=history ]

Brian Minchau updated XALANJ-1969:
----------------------------------

    Component: XPath-function

I'm going to attach node-lister.xsl (thanks go to Henry Zonargo for this one), 
and this stylesheet lists the various preceeding nodes to help understand what 
is being counted.

The output of that stylesheet with XSLTC is:
<preceding-count xmlns:my="http://my.com";>21</preceding-count><out 
xmlns:my="http://my.com";>
<node element-node-name="h1"/>
<node text-node-value="This is an XML/HTML document"/>
<node element-node-name="p"/>
<node text-node-value="It's intended to be used to test whitespace preservation 
and stripping."/>
<node element-node-name="p"/>
<node text-node-value="In order to do this, it must have a variety of 
interesting data."/>
<node comment-node-value=" Alternate between xml:space=&quot;preserve&quot; and 
xml:space=&quot;default&quot; "/>
<node element-node-name="div"/>
<node text-node-value="&#10;        "/>
<node element-node-name="p"/>
<node comment-node-value=" The u element has multiple text, whitespace, and 
element children.  The element children change xml:space. "/>
<node element-node-name="u"/>
<node text-node-value=" Hello"/>
<node element-node-name="u"/>
<node text-node-value="  "/>
<node element-node-name="u"/>
<node text-node-value="  "/>
<node element-node-name="b"/>
<node text-node-value="World "/>
<node text-node-value="  "/>
<node text-node-value="&#10;        "/>
<node element-node-name="span"/>
<node comment-node-value=" Always preserve CDATA whitespace "/>
<node text-node-value="    &#10;        "/>
<node element-node-name="table"/>
<node text-node-value="&#10;            "/>
<node element-node-name="tr"/>
<node text-node-value="&#10;                "/>
<node element-node-name="td"/>
<node text-node-value=" Column 1 "/>
<node text-node-value="&#10;            "/>
<node text-node-value="&#10;            "/>
<node element-node-name="tr"/>
<node text-node-value="&#10;                "/>
<node element-node-name="td"/>
<node text-node-value=" Column 2 "/>
<node text-node-value="&#10;            "/>
<node text-node-value="&#10;        "/>
<node text-node-value="&#10;    "/>
<node comment-node-value=" Use namespaces "/>
</out>

And one can count the 21 (not 22) text nodes.  Xalan-J interpretive has a bug 
here, when run it drops ALL whitespace only text nodes and that results in the 
incorrect value of 7.

> xml:space not considered when deciding which elements to strip
> --------------------------------------------------------------
>
>          Key: XALANJ-1969
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-1969
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan-interpretive, XPath-function
>     Versions: 2.6
>     Reporter: elharo
>  Attachments: 91444.xml, 91444.xsl
>
> This report is based on OASIS Microsoft test case Whitespaces__91444. In 
> breif the expected output is 22, but the actual output is 7. I'm not sure 22 
> is correct, but I'm pretty sure 7 isn't. The stylesheet is as follows:
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:my="http://my.com";>
>     <xsl:output omit-xml-declaration="yes" encoding="UTF-8" indent="no"/>
>     <xsl:strip-space elements="*"/>
>     <xsl:template match="/">
>        <!-- Preceding query (selection) -->
>        <preceding-count><xsl:value-of 
> select="count(html/my:element/preceding::text())"/></preceding-count>
>     </xsl:template>
> </xsl:stylesheet>
> If all white space nodes are stripped from the input document, then the 
> expected output would be what Xalan gives:
> $ java 
> -Xbootclasspath/p:/opt/xalan-j_2_6_0/bin/xalan.jar:/opt/xalan-j_2_6_0/bin/xercesImpl.jar:/opt/xalan-j_2_6_0/bin/xalansamples.jar
>  org.apache.xalan.xslt.Process -IN 91444.xml -XSL 91444.xsl
> <preceding-count 
> xmlns:my="http://my.com";>7</preceding-count>~/Projects/XOM/datas$ 
> sis-xslt-testsuite/TESTS/MSFT_Conformance_Tests/Whitespaces
> However, the input document contains a number of white space only nodes for 
> which xml:space="true", and according to section 3.4 of thre XSLT spec, these 
> node should be preserved regardless.
> FYI, libxslt shares this bug; i.e. it also gives 7 as the output. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to