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

RE: applying different templates to one element, at di

Subject: RE: applying different templates to one element, at differents result nodes
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Fri, 29 Dec 2000 11:58:10 -0000
newpage and xsl or xpath
JS,
I don't see how yur example works as there is no result node in your input
to trigger your result template. What you want to achieve can probably be
done with modes.

<xsl:template match="card">
	<result>
		<xsl:apply-templates mode="head" />
		<newpage>
			<xsl:apply-templates mode="page" />
		</newpage>
	</result>
</xsl:template>
<xsl:template match="link" mode="head">
	<resulthead><xsl:value-of select="src" /> <xsl:value-of select="href"
/></resulthead>
</xsl:template>
<xsl:template match="link" mode="page">
	<newnode><xsl:value-of select="src" /></newnode>
</xsl:template>

Or some variation.

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Floch
>Jean-Sibastien
>Sent: 29 December 2000 09:04
>To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
>Subject:  applying different templates to one element, at
>differents result nodes
>
>
>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
>


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


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.