This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
applying different templates to one element, at differents result nodes
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] applying different templates to one element, at differents result nodes
- From: Floch "Jean-Sébastien" <jsfloch at yahoo dot com>
- Date: Fri, 29 Dec 2000 01:04:16 -0800 (PST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
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