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

Re: creating links to resource files listed in XML fil

Subject: Re: creating links to resource files listed in XML file
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Jul 2002 10:13:06 +0100
creating links with xml
Hi Brian,

> I want to create some links to resource files which are referenced
> in my .xml file. In my .xsl file I have added the following code:

Use an attribute value template. In an attribute, you can put {}s
around an expression in order to have it evaluated and the result
inserted into the attribute value:

<xsl:template match="/">
  <xsl:for-each select="//file/@href">
    <xsl:variable name="myVar" select="." />
    <a href="{$myVar}">
      <xsl:value-of select="$myVar"/>
    </a>
  </xsl:for-each>
</xsl:template>

You can also use xsl:attribute to create the attribute; it's longer,
but it's more flexible at times:

<xsl:template match="/">
  <xsl:for-each select="//file/@href">
    <xsl:variable name="myVar" select="." />
    <a>
      <xsl:attribute name="href">
        <xsl:value-of select="$myVar"/>
      </xsl:attribute>
      <xsl:value-of select="$myVar"/>
    </a>
  </xsl:for-each>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.