[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: copy attribute question

Subject: RE: copy attribute question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 24 Mar 2009 22:48:44 -0000
RE:  copy attribute question
If template 1 doesn't produce any output that's because it's not being
invoked. Where is the apply-templates call that selects a node that it would
match?

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Garvin Riensche [mailto:g.riensche@xxxxxxx] 
> Sent: 24 March 2009 22:14
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  copy attribute question
> 
> Hello,
> 
> I am wondering why the context seems to be different in the 
> following templates because I thought the output would be the same.
> 
> Input:
> <a id="1"/>
> 
> Template 1:
> <xsl:template match="a/@*">
>    <aa>
>      <xsl:copy/>
>    </aa>
> </xsl:template>
> 
> Template 2:
> <xsl:template match="a">
>    <xsl:for-each select="@*">
>      <aa>
>        <xsl:copy/>
>      </aa>
>    </xsl:for-each>
> </xsl:template>
> 
> Template 1 doesn't produce any output and template 2 outputs:
> <aa id="1"/>
> 
> Why doesn't Template 1 copy the attribute node to element 
> <aa> like template 2?
> 
> 
> regards,
> Garvin

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.