You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Alain Le Guennec (JIRA)" <xa...@xml.apache.org> on 2006/08/27 21:35:58 UTC

[jira] Created: (XALANC-624) The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()

The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()
----------------------------------------------------------------------------------------------------------------------------------

                 Key: XALANC-624
                 URL: http://issues.apache.org/jira/browse/XALANC-624
             Project: XalanC
          Issue Type: Bug
          Components: XalanC
    Affects Versions: 1.10
         Environment: winxp-sp2
            Reporter: Alain Le Guennec
         Attachments: StylesheetRoot.cpp

The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set().
Consider the following stylesheet (applied to any input document, the actual input does not matter):

<?xml version="1.0"  encoding = "ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common">

	<xsl:key name="lookup-by-name" match="*" use="local-name()"/>

	<xsl:variable name="test-tree-rtf"><N1><N2><N3></N3></N2></N1></xsl:variable>
	<xsl:variable name="test-tree" select="exsl:node-set($test-tree-rtf)/*"/>

	<xsl:template match="/">
		<!-- key() with context within the result tree fragment. -->
		<xsl:for-each select="$test-tree">
			<xsl:for-each select=".">
				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
				<xsl:choose>
					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</xsl:for-each>
		<!-- key() with context being the root of the result tree fragment. -->
		<xsl:for-each select="$test-tree">
			<xsl:for-each select="/">
				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
				<xsl:choose>
					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</xsl:for-each>
	</xsl:template>

</xsl:stylesheet>

In the two cases, the key() function should return the N1 node belonging to the result tree fragment
(because the result tree fragment is acting as the "context document" in both cases).
However, it works only in the first case (it prints "OK"), not the second (it prints "BUG").
I could find that the cause of the bug is in the function getKeyNode() of StylesheetRoot.cpp.
This function does not work when the context node is a DOCUMENT_FRAGMENT_NODE to start with.
I rewrote it so that it works in that case too (see attachment).

Best regards,
Alain Le Guennec.

-- 
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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANC-624) The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANC-624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Bertoni resolved XALANC-624.
----------------------------------

       Resolution: Fixed
    Fix Version/s: CurrentCVS

Patch is applied.  If possible, can you please verify the fix?

> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANC-624
>                 URL: https://issues.apache.org/jira/browse/XALANC-624
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.10
>         Environment: winxp-sp2
>            Reporter: Alain Le Guennec
>         Assigned To: David Bertoni
>             Fix For: CurrentCVS
>
>         Attachments: bug-key.xslt, patch.diff, StylesheetRoot.cpp
>
>
> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set().
> Consider the following stylesheet (applied to any input document, the actual input does not matter):
> <?xml version="1.0"  encoding = "ISO-8859-1"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common">
> 	<xsl:key name="lookup-by-name" match="*" use="local-name()"/>
> 	<xsl:variable name="test-tree-rtf"><N1><N2><N3></N3></N2></N1></xsl:variable>
> 	<xsl:variable name="test-tree" select="exsl:node-set($test-tree-rtf)/*"/>
> 	<xsl:template match="/">
> 		<!-- key() with context within the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select=".">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 		<!-- key() with context being the root of the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select="/">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 	</xsl:template>
> </xsl:stylesheet>
> In the two cases, the key() function should return the N1 node belonging to the result tree fragment
> (because the result tree fragment is acting as the "context document" in both cases).
> However, it works only in the first case (it prints "OK"), not the second (it prints "BUG").
> I could find that the cause of the bug is in the function getKeyNode() of StylesheetRoot.cpp.
> This function does not work when the context node is a DOCUMENT_FRAGMENT_NODE to start with.
> I rewrote it so that it works in that case too (see attachment).
> Best regards,
> Alain Le Guennec.

-- 
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] Assigned: (XALANC-624) The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANC-624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Bertoni reassigned XALANC-624:
------------------------------------

    Assignee: David Bertoni

> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANC-624
>                 URL: https://issues.apache.org/jira/browse/XALANC-624
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.10
>         Environment: winxp-sp2
>            Reporter: Alain Le Guennec
>         Assigned To: David Bertoni
>         Attachments: bug-key.xslt, patch.diff, StylesheetRoot.cpp
>
>
> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set().
> Consider the following stylesheet (applied to any input document, the actual input does not matter):
> <?xml version="1.0"  encoding = "ISO-8859-1"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common">
> 	<xsl:key name="lookup-by-name" match="*" use="local-name()"/>
> 	<xsl:variable name="test-tree-rtf"><N1><N2><N3></N3></N2></N1></xsl:variable>
> 	<xsl:variable name="test-tree" select="exsl:node-set($test-tree-rtf)/*"/>
> 	<xsl:template match="/">
> 		<!-- key() with context within the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select=".">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 		<!-- key() with context being the root of the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select="/">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 	</xsl:template>
> </xsl:stylesheet>
> In the two cases, the key() function should return the N1 node belonging to the result tree fragment
> (because the result tree fragment is acting as the "context document" in both cases).
> However, it works only in the first case (it prints "OK"), not the second (it prints "BUG").
> I could find that the cause of the bug is in the function getKeyNode() of StylesheetRoot.cpp.
> This function does not work when the context node is a DOCUMENT_FRAGMENT_NODE to start with.
> I rewrote it so that it works in that case too (see attachment).
> Best regards,
> Alain Le Guennec.

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

        

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


[jira] Commented: (XALANC-624) The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()

Posted by "Dmitry Hayes (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANC-624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468662 ] 

Dmitry Hayes commented on XALANC-624:
-------------------------------------

The patch looks ok . Let's commit it .Thanks!
Dmitry 

> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANC-624
>                 URL: https://issues.apache.org/jira/browse/XALANC-624
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.10
>         Environment: winxp-sp2
>            Reporter: Alain Le Guennec
>         Assigned To: David Bertoni
>         Attachments: bug-key.xslt, patch.diff, StylesheetRoot.cpp
>
>
> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set().
> Consider the following stylesheet (applied to any input document, the actual input does not matter):
> <?xml version="1.0"  encoding = "ISO-8859-1"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common">
> 	<xsl:key name="lookup-by-name" match="*" use="local-name()"/>
> 	<xsl:variable name="test-tree-rtf"><N1><N2><N3></N3></N2></N1></xsl:variable>
> 	<xsl:variable name="test-tree" select="exsl:node-set($test-tree-rtf)/*"/>
> 	<xsl:template match="/">
> 		<!-- key() with context within the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select=".">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 		<!-- key() with context being the root of the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select="/">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 	</xsl:template>
> </xsl:stylesheet>
> In the two cases, the key() function should return the N1 node belonging to the result tree fragment
> (because the result tree fragment is acting as the "context document" in both cases).
> However, it works only in the first case (it prints "OK"), not the second (it prints "BUG").
> I could find that the cause of the bug is in the function getKeyNode() of StylesheetRoot.cpp.
> This function does not work when the context node is a DOCUMENT_FRAGMENT_NODE to start with.
> I rewrote it so that it works in that case too (see attachment).
> Best regards,
> Alain Le Guennec.

-- 
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: (XALANC-624) The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()

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

David Bertoni commented on XALANC-624:
--------------------------------------

Patch to clean up the whole key retrieval process is attached.  Committers, can you please review?

> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set()
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANC-624
>                 URL: https://issues.apache.org/jira/browse/XALANC-624
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.10
>         Environment: winxp-sp2
>            Reporter: Alain Le Guennec
>         Assigned To: David Bertoni
>         Attachments: bug-key.xslt, patch.diff, StylesheetRoot.cpp
>
>
> The key() function does not work when the context node is the root node of a result tree fragment obtained through exsl:node-set().
> Consider the following stylesheet (applied to any input document, the actual input does not matter):
> <?xml version="1.0"  encoding = "ISO-8859-1"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common">
> 	<xsl:key name="lookup-by-name" match="*" use="local-name()"/>
> 	<xsl:variable name="test-tree-rtf"><N1><N2><N3></N3></N2></N1></xsl:variable>
> 	<xsl:variable name="test-tree" select="exsl:node-set($test-tree-rtf)/*"/>
> 	<xsl:template match="/">
> 		<!-- key() with context within the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select=".">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 		<!-- key() with context being the root of the result tree fragment. -->
> 		<xsl:for-each select="$test-tree">
> 			<xsl:for-each select="/">
> 				<xsl:variable name="n1" select="key('lookup-by-name', 'N1')"/>
> 				<xsl:choose>
> 					<xsl:when test="count($n1)=1"><xsl:message>OK </xsl:message></xsl:when>
> 					<xsl:otherwise><xsl:message>BUG </xsl:message></xsl:otherwise>
> 				</xsl:choose>
> 			</xsl:for-each>
> 		</xsl:for-each>
> 	</xsl:template>
> </xsl:stylesheet>
> In the two cases, the key() function should return the N1 node belonging to the result tree fragment
> (because the result tree fragment is acting as the "context document" in both cases).
> However, it works only in the first case (it prints "OK"), not the second (it prints "BUG").
> I could find that the cause of the bug is in the function getKeyNode() of StylesheetRoot.cpp.
> This function does not work when the context node is a DOCUMENT_FRAGMENT_NODE to start with.
> I rewrote it so that it works in that case too (see attachment).
> Best regards,
> Alain Le Guennec.

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

        

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