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

Re: basic xpath question

Subject: Re: basic xpath question
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 Jun 2002 10:32:27 +0100
xpath url match
Hi Dominic,

> I have an xml document to be styled, if I have a construct such as
>
> <section id="para">this is text <section id="url"
> url="http://xx.yy.zz">which is to be a link</section></section>
>
> How do I, in xslt, recognise the "url" tag within the "para" tag,
> such that I could ouput someting like
>
> <p>this is test <a href="http://xx.yy.zz">which is to be a link</a></p>

The simplest way would be to use templates that match section elements
with different values for their id attributes:

<xsl:template match="section[@id = 'para']">
  <p><xsl:apply-templates /></p>
</xsl:template>

<xsl:template match="section[@id = 'url']">
  <a href="{@url}"><xsl:apply-templates /></a>
</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.