You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Daniel B. (JIRA)" <xa...@xml.apache.org> on 2009/11/10 22:37:28 UTC

[jira] Commented: (XALANJ-1969) xml:space not considered when deciding which elements to strip

    [ https://issues.apache.org/jira/browse/XALANJ-1969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776092#action_12776092 ] 

Daniel B. commented on XALANJ-1969:
-----------------------------------

This bug still exists in Xalan-J 2.7.1.

By the way, the XSLT specification's section 3.4, Whitespace Stripping (at 
http://www.w3.org/TR/xslt#strip), specifies the required behavior pretty clearly:


A text node is preserved if any of the following apply:
   ...
    *  An ancestor element of the text node has an xml:space attribute with a value of 
     preserve, and no closer ancestor element has xml:space with a value of default.


> xml:space not considered when deciding which elements to strip
> --------------------------------------------------------------
>
>                 Key: XALANJ-1969
>                 URL: https://issues.apache.org/jira/browse/XALANJ-1969
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan-interpretive, XPath-function
>    Affects Versions: 2.6
>            Reporter: elharo
>         Attachments: 91444.xml, 91444.xsl, node-lister.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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org