You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Jeffrey Barrus (JIRA)" <xa...@xml.apache.org> on 2008/09/10 17:22:44 UTC

[jira] Created: (XALANJ-2457) xsl:number fails when count item is doubly nested and end tag is on same line

xsl:number fails when count item is doubly nested and end tag is on same line
-----------------------------------------------------------------------------

                 Key: XALANJ-2457
                 URL: https://issues.apache.org/jira/browse/XALANJ-2457
             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
    Affects Versions: 2.7.1
         Environment: WinXP, testing with xalanj in custom java as well as in Oxygen 9
            Reporter: Jeffrey Barrus


test case:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="top">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="middle">
        <xsl:number format="1" from="top" level="any" count="bottom"/>
    </xsl:template>
</xsl:stylesheet>


<?xml version="1.0" encoding="UTF-8"?>
<top>
    <middle>
        <test><bottom/><bottom/></test>
    </middle>
    <middle/>
</top>

The output is correctly

0
2


However, if the xml is changed so that the first /middle tag is at the end of the line rather than on a new line of it's own

<top>
    <middle>
        <test><bottom/><bottom/></test></middle>
    <middle/>
</top>


The output becomes
0
0

It appears that it does not count the two bottom tags if the /middle tag is on the end of the line.  I tried this with multiple other sets of markup and the results are the same.

-- 
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


[jira] Commented: (XALANJ-2457) xsl:number fails when count item is doubly nested and end tag is on same line

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629863#action_12629863 ] 

David Bertoni commented on XALANJ-2457:
---------------------------------------

Actually, both results are wrong.  Xalan-J needs to implement the following erratum from the XSLT recommendation:

"E23 - Substantive.

    Section 7.7, sixth bullet. Behavior unspecified when xsl:number level="any" and there are no matching nodes. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Apr/0017.html (members only).

        * When level="any", it constructs a list of length one containing the number of nodes that match the count pattern and belong to the set containing the current node and all nodes at any level of the document that are before the current node in document order, excluding any namespace and attribute nodes (in other words the union of the members of the preceding and ancestor-or-self axes). If there are no matching nodes, it constructs an empty list. If the from attribute is specified, then only nodes after the first node before the current node that match the from pattern are considered."

Here's a stylesheet that produces a well-formed document to illustrate:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output encoding="UTF-8" />

  <xsl:template match="/">
   <out><xsl:apply-templates /></out>
  </xsl:template>

  <xsl:template match="middle">
      <number><xsl:number format="1" from="top" level="any" count="bottom"/></number>
  </xsl:template>

  <xsl:template match="text()" />

</xsl:stylesheet>

The correct output in both cases should be:

<?xml version="1.0" encoding="UTF-8"?><out><number/><number>2</number></out>

Note that the bug is a result of a whitespace-only text node introduced into the source tree between the two "middle" element nodes.

> xsl:number fails when count item is doubly nested and end tag is on same line
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2457
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2457
>             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
>    Affects Versions: 2.7.1
>         Environment: WinXP, java 1.6.0_07 testing with xalanj in custom java as well as in Oxygen 9 XSLT Debugger
>            Reporter: Jeffrey Barrus
>
> test case:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>     <xsl:template match="top">
>         <xsl:apply-templates/>
>     </xsl:template>
>     <xsl:template match="middle">
>         <xsl:number format="1" from="top" level="any" count="bottom"/>
>     </xsl:template>
> </xsl:stylesheet>
> <?xml version="1.0" encoding="UTF-8"?>
> <top>
>     <middle>
>         <test><bottom/><bottom/></test>
>     </middle>
>     <middle/>
> </top>
> The output is correctly
> 0
> 2
> However, if the xml is changed so that the first /middle tag is at the end of the line rather than on a new line of it's own
> <top>
>     <middle>
>         <test><bottom/><bottom/></test></middle>
>     <middle/>
> </top>
> The output becomes
> 0
> 0
> It appears that it does not count the two bottom tags if the /middle tag is on the end of the line.  I tried this with multiple other sets of markup and the results are the same.

-- 
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


[jira] Commented: (XALANJ-2457) xsl:number fails when count item is doubly nested and end tag is on same line

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629884#action_12629884 ] 

David Bertoni commented on XALANJ-2457:
---------------------------------------

Jeffrey,

Can you attach your sample stylesheet and source documents to this Jira issue as files and grant a license to the ASF?  I would like to get this into the conformance suite and the bug into the regression suite.

Thanks!

Dave

> xsl:number fails when count item is doubly nested and end tag is on same line
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2457
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2457
>             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
>    Affects Versions: 2.7.1
>         Environment: WinXP, java 1.6.0_07 testing with xalanj in custom java as well as in Oxygen 9 XSLT Debugger
>            Reporter: Jeffrey Barrus
>
> test case:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>     <xsl:template match="top">
>         <xsl:apply-templates/>
>     </xsl:template>
>     <xsl:template match="middle">
>         <xsl:number format="1" from="top" level="any" count="bottom"/>
>     </xsl:template>
> </xsl:stylesheet>
> <?xml version="1.0" encoding="UTF-8"?>
> <top>
>     <middle>
>         <test><bottom/><bottom/></test>
>     </middle>
>     <middle/>
> </top>
> The output is correctly
> 0
> 2
> However, if the xml is changed so that the first /middle tag is at the end of the line rather than on a new line of it's own
> <top>
>     <middle>
>         <test><bottom/><bottom/></test></middle>
>     <middle/>
> </top>
> The output becomes
> 0
> 0
> It appears that it does not count the two bottom tags if the /middle tag is on the end of the line.  I tried this with multiple other sets of markup and the results are the same.

-- 
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


[jira] Commented: (XALANJ-2457) xsl:number fails when count item is doubly nested and end tag is on same line

Posted by "Jeffrey Barrus (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630190#action_12630190 ] 

Jeffrey Barrus commented on XALANJ-2457:
----------------------------------------

The attach page states that test cases do not need to have a licenses granted to the ASF.  However, I checked the box anyway.

> xsl:number fails when count item is doubly nested and end tag is on same line
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2457
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2457
>             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
>    Affects Versions: 2.7.1
>         Environment: WinXP, java 1.6.0_07 testing with xalanj in custom java as well as in Oxygen 9 XSLT Debugger
>            Reporter: Jeffrey Barrus
>         Attachments: test.xml, test.xsl
>
>
> test case:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>     <xsl:template match="top">
>         <xsl:apply-templates/>
>     </xsl:template>
>     <xsl:template match="middle">
>         <xsl:number format="1" from="top" level="any" count="bottom"/>
>     </xsl:template>
> </xsl:stylesheet>
> <?xml version="1.0" encoding="UTF-8"?>
> <top>
>     <middle>
>         <test><bottom/><bottom/></test>
>     </middle>
>     <middle/>
> </top>
> The output is correctly
> 0
> 2
> However, if the xml is changed so that the first /middle tag is at the end of the line rather than on a new line of it's own
> <top>
>     <middle>
>         <test><bottom/><bottom/></test></middle>
>     <middle/>
> </top>
> The output becomes
> 0
> 0
> It appears that it does not count the two bottom tags if the /middle tag is on the end of the line.  I tried this with multiple other sets of markup and the results are the same.

-- 
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


[jira] Commented: (XALANJ-2457) xsl:number fails when count item is doubly nested and end tag is on same line

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630332#action_12630332 ] 

David Bertoni commented on XALANJ-2457:
---------------------------------------

Yes, if you provide a test case in the bug report, it doesn't need to be licensed.  However, to incorporate this into regression or conformance tests, we need a license, since it will become part of the project.

Thanks for help!

> xsl:number fails when count item is doubly nested and end tag is on same line
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2457
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2457
>             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
>    Affects Versions: 2.7.1
>         Environment: WinXP, java 1.6.0_07 testing with xalanj in custom java as well as in Oxygen 9 XSLT Debugger
>            Reporter: Jeffrey Barrus
>         Attachments: test.xml, test.xsl
>
>
> test case:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>     <xsl:template match="top">
>         <xsl:apply-templates/>
>     </xsl:template>
>     <xsl:template match="middle">
>         <xsl:number format="1" from="top" level="any" count="bottom"/>
>     </xsl:template>
> </xsl:stylesheet>
> <?xml version="1.0" encoding="UTF-8"?>
> <top>
>     <middle>
>         <test><bottom/><bottom/></test>
>     </middle>
>     <middle/>
> </top>
> The output is correctly
> 0
> 2
> However, if the xml is changed so that the first /middle tag is at the end of the line rather than on a new line of it's own
> <top>
>     <middle>
>         <test><bottom/><bottom/></test></middle>
>     <middle/>
> </top>
> The output becomes
> 0
> 0
> It appears that it does not count the two bottom tags if the /middle tag is on the end of the line.  I tried this with multiple other sets of markup and the results are the same.

-- 
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