|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] applying different templates to one element, at differ
Hello
I've a question for you all, and i hope you will
help me
My xml is like this:
<page>
<card>
<link>
<src>1src1</src>
<href>1href1</href>
</link>
<link>
<src>2src2</src>
<href>2href2</href>
</link>
<link>
<src>3src3</src>
<href>3href3</href>
</link>
</card>
</page>
And i want as a result of xsl transformation
something like:
<result>
<resulthead>1src1 1href1</resulthead>
<resulthead>2src2 2href2</resulthead>
<resulthead>3src3 3href3</resulthead>
<newpage>
<newnode>1src1</newnode>
<newnode>2src2</newnode>
<newnode>3src3</newnode>
</newpage>
</result>
But the way i want to do this is a little more
complex than just using
<xsl:template match="result">
<resulthead>
<xsl:for-each select="//link">
<xsl:value-of select="src"/> <xsl:value-of
select="href"/>
</xsl:for-each>
<xsl:apply-templates/>
</resulthead>
</xsl:template>
<xsl:template match="link">
<xsl:value-of select="src"/>
</xsl:template>
I know it works, but i can't use it in my context
(obviously my real xml is not as simple as i wrote it
upward)
The thing i really want to do is everytime i find a
tag <link> in my xsl, i want to apply its template
'where' i am,
but i want too apply an other template at the root
node
Is there a way to do it?
Thanks,
Jean-Sebastien Floch
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








