[ https://issues.apache.org/jira/browse/XALANJ-2818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17957029#comment-17957029 ]
Martin Honnen commented on XALANJ-2818: --------------------------------------- There is also a test case [https://github.com/w3c/xslt30-test/blob/master/tests/attr/match/_match-test-set.xml#L1018] in the XSLT 3.0 test suite that runs the stylesheet {code:java} <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="child::document-node()"> <d>WRONG</d> </xsl:template> <xsl:template match="*"> <out>OK</out> </xsl:template> </xsl:stylesheet> {code} against the input {code:java} <doc> <foo att1="c"> <foo att1="b"> <foo att1="a"> <baz att1="wrong"/> </foo> </foo> </foo> </doc>{code} the expected output is {code:java} <out>OK</out>{code} with Xalan (XSLT 3.0 development branch) I get {code:java} <d>WRONG</d>{code} > document-node() matches/selects more than document nodes > -------------------------------------------------------- > > Key: XALANJ-2818 > URL: https://issues.apache.org/jira/browse/XALANJ-2818 > 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, Xalan-CmdLine, XPath > Affects Versions: The Latest Development Code > Environment: Java 8, Windows 11 > Reporter: Martin Honnen > Assignee: Joe Kesselman > Priority: Major > Attachments: document-node-test1.xsl, document-node-test2.xsl, > sample2.xml > > > This is a bug report against the XSLT 3.0 development branch of Xalan. > I find that document-node() matches/selects a lot more than just document > nodes. > Here are two test cases: > > > {code:java} > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="3.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:map="http://www.w3.org/2005/xpath-functions/map" > xmlns:array="http://www.w3.org/2005/xpath-functions/array" > exclude-result-prefixes="#all"> > <xsl:output method="text"/> > <xsl:template match="/"> > <xsl:value-of select="count(descendant-or-self::document-node())"/> > </xsl:template> > </xsl:stylesheet> > {code} > > which should output 1 for any XML input but seems to output the number of > nodes in the whole input document and > > {code:java} > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="3.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:map="http://www.w3.org/2005/xpath-functions/map" > xmlns:array="http://www.w3.org/2005/xpath-functions/array" > exclude-result-prefixes="#all"> > <xsl:output method="text"/> > > <xsl:param name="count" as="xs:integer" select="1"/> > <xsl:template match="document-node()"> > <xsl:param name="count" select="$count"/> > <xsl:text>Matching document-node() </xsl:text> > <xsl:value-of select="$count"/> > <xsl:text> </xsl:text> > <xsl:apply-templates> > <xsl:with-param name="count" select="$count + 1"/> > </xsl:apply-templates> > </xsl:template> > </xsl:stylesheet> > {code} > which should process the single document nodes but with Xalan processes lots > of nodes e.g. outputs > > {noformat} > Matching document-node() 1 > Matching document-node() 2 > Matching document-node() 3 > Matching document-node() 3 > Matching document-node() 4 > Matching document-node() 4 > Matching document-node() 5 > Matching document-node() 4 > Matching document-node() 4 > Matching document-node() 5 > Matching document-node() 4 > Matching document-node() 3 > Matching document-node() 3 > Matching document-node() 4 > Matching document-node() 4 > Matching document-node() 5 > Matching document-node() 4 > Matching document-node() 4 > Matching document-node() 5 > Matching document-node() 4 > Matching document-node() 3{noformat} > Input sample is e.g. > {code:java} > <root> > <div> > <para>This is a test.</para> > <para>This is a test.</para> > </div> > <div> > <para>This is a second test.</para> > <para>This is a second test.</para> > </div> > </root>{code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For additional commands, e-mail: dev-h...@xalan.apache.org