Hi list,
I am experiencing some oddities when applying an XSLT transformation in an XPL pipeline: I am using the following to just copy all unmatched nodes: <xsl:template match="node()" priority="-2"><xsl:copy><xsl:apply-templates select="node()"/></xsl:copy></xsl:template> However, if I do so, all attributes are lost. If I change the select to "@*| node()", it works fine. According to XPath spec, node() matches all nodes, no matter what their type is - so, adding @* should definitely not make any difference at all. Or do I miss something? Kind regards, Ralf Jung -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
It's true you need @* to get the attributes in an identity transform in XSLT: http://en.wikipedia.org/wiki/Identity_transform#Using_XSLT
Ethan On Tue, May 31, 2011 at 12:46 PM, Ralf Jung <[hidden email]> wrote: Hi list, -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hm, so it doesn't seem to be a bug - but I still do not understand why. An
attribute node *is* a node, isn't it? Kind regards, Ralf Am Dienstag 31 Mai 2011, um 18:51:41 schrieb Ethan Gruber: > It's true you need @* to get the attributes in an identity transform in > XSLT: http://en.wikipedia.org/wiki/Identity_transform#Using_XSLT > > Ethan > > On Tue, May 31, 2011 at 12:46 PM, Ralf Jung <[hidden email]> wrote: > > Hi list, > > > > I am experiencing some oddities when applying an XSLT transformation in > > an XPL > > pipeline: I am using the following to just copy all unmatched nodes: > > > > <xsl:template match="node()" priority="-2"><xsl:copy><xsl:apply-templates > > select="node()"/></xsl:copy></xsl:template> > > > > However, if I do so, all attributes are lost. If I change the select to > > "@*| > > node()", it works fine. According to XPath spec, node() matches all > > nodes, no > > matter what their type is - so, adding @* should definitely not make any > > difference at all. Or do I miss something? > > > > Kind regards, > > Ralf Jung > > > > > > -- > > You receive this message as a subscriber of the [hidden email] mailing > > list. > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > OW2 mailing lists service home page: http://www.ow2.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Ralf,
An attribute is definitely a node! The awkwardness of the node() function in XSLT and XPath goes back to the last century, with XSLT 1.0/XPath 1.0 in 1999. -Erik On Wed, Jun 1, 2011 at 1:07 AM, Ralf Jung <[hidden email]> wrote: > Hm, so it doesn't seem to be a bug - but I still do not understand why. An > attribute node *is* a node, isn't it? > > Kind regards, > Ralf > > Am Dienstag 31 Mai 2011, um 18:51:41 schrieb Ethan Gruber: >> It's true you need @* to get the attributes in an identity transform in >> XSLT: http://en.wikipedia.org/wiki/Identity_transform#Using_XSLT >> >> Ethan >> >> On Tue, May 31, 2011 at 12:46 PM, Ralf Jung <[hidden email]> wrote: >> > Hi list, >> > >> > I am experiencing some oddities when applying an XSLT transformation in >> > an XPL >> > pipeline: I am using the following to just copy all unmatched nodes: >> > >> > <xsl:template match="node()" priority="-2"><xsl:copy><xsl:apply-templates >> > select="node()"/></xsl:copy></xsl:template> >> > >> > However, if I do so, all attributes are lost. If I change the select to >> > "@*| >> > node()", it works fine. According to XPath spec, node() matches all >> > nodes, no >> > matter what their type is - so, adding @* should definitely not make any >> > difference at all. Or do I miss something? >> > >> > Kind regards, >> > Ralf Jung >> > >> > >> > -- >> > You receive this message as a subscriber of the [hidden email] mailing >> > list. >> > To unsubscribe: mailto:[hidden email] >> > For general help: mailto:[hidden email]?subject=help >> > OW2 mailing lists service home page: http://www.ow2.org/wws > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |