You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "David Bertoni (JIRA)" <xa...@xml.apache.org> on 2005/10/02 20:55:47 UTC

[jira] Commented: (XALANJ-2207) Attribute is not a node

    [ http://issues.apache.org/jira/browse/XALANJ-2207?page=comments#action_12331096 ] 

David Bertoni commented on XALANJ-2207:
---------------------------------------

The match pattern "node()" does not match attributes, because "node()" is an abbreviation for "child::node()" and attributes are not children of their owning elements.  From the XSLT recommendation, section 5.2:

http://www.w3.org/TR/xslt#patterns

"node() matches any node other than an attribute node and the root node"

There is a built-in template for attributes for _every_ mode that generates a text node in the result true with the value of the attribute:

http://www.w3.org/TR/xslt#built-in-rule

which is why you see the text "bar" in the result tree.

I believe this is not a bug, and this issue should be marked invalid.  In the future, please consider asking questions on the Xalan-J user list before you create a Jira issue.

> Attribute is not a node
> -----------------------
>
>          Key: XALANJ-2207
>          URL: http://issues.apache.org/jira/browse/XALANJ-2207
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.7
>  Environment: Linux amd64, java 1.5.0-05 64bit server mode
>     Reporter: Martin Vysny

>
> Let the context attribute be foo="bar". I have the following template:
> <xsl:template match="*" mode="baz" priority="1">
>   something2
> </xsl:template>
> <xsl:template match="node()" mode="baz" priority="0">
>   something
> </xsl:template>
> When the context node is attribute and i call <xsl:apply-templates select="." mode="baz"/> it outputs text 'bar'. When I modify the template to
> <xsl:template match="node() | @*" mode="baz" priority="0">
>   something
> </xsl:template>
> It outputs 'something' as it should. I think there are two errors:
> - attribute is not a node,
> - why it outputs the attribute value when the mode is not matched?

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