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

applying different templates to one element, at differ

Subject: applying different templates to one element, at differents result nodes
From: Floch "Jean-Sébastien" <jsfloch@xxxxxxxxx>
Date: Fri, 29 Dec 2000 01:04:16 -0800 (PST)
different templates
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


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.