xsl-list
[Top] [All Lists]

RE: [xsl] copy attribute question

2009-03-24 18:49:10
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(_dot_)riensche(_at_)gmx(_dot_)net] 
Sent: 24 March 2009 22:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>