Re: [xsl] "*|@*|text()" vs. "node()"

Subject: Re: [xsl] "*|@*|text()" vs. "node()"
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 4 Oct 2001 15:53:59 +0100
> instead of <xsl:apply-templates select="*|@*|text()"/>, I think you just
> want <xsl:apply-templates> otherwise, you're applying the templates to the
> children of whatever matches the template first and not getting the original
> match.  

You have that (at best) backwards. <xsl:apply-templates/>  just matches
on children (not the current node, and not attributes). 
<xsl:apply-templates select="*|@*|text()"/>
matches on child elements and text nodes, but not comments or pi's and
also matches on attributes.


> Also, I think that it's going to match everything so all the
> children 3 levels nested and below are going to be repeated.

No.

> As far as the attribute, I don't believe you can have <xsl:choose>
> as a child of <xsl:attribute>.

Yes you can, why would you think not?

> Also, you can't have <xsl:attribute> without an opening
> element before it..  
That is immediate from the structure of XML. the xsl:template
element opens before xsl:attribute. there's nothing wrong with

<xsl:template match="@href">
   <xsl:attribute name="href">

> Also, I don't know if it would make a difference, but
> try <xsl:template match="*/@href"> instead of simply match="href"

You meant "@href" not "href". It does make a difference: it affects the
default priority, but it doesn't affect the nodes matched.

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread