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

Re: can templates be nested?

Subject: Re: can templates be nested?
From: Mike Brown <mike@xxxxxxxx>
Date: Sun, 16 Jun 2002 02:00:36 -0600 (MDT)
turkey tracks template
dmitri kerievsky wrote:
>  question is how to transfer the mailto value:
> <xsl:template match="catalog/artist/album/label/person">
>   <a href="{concat('mailto:', @email)}">
>     <xsl:value-of select="@name"/>
>   </a>
> </xsl:template>

When pasting code samples, please re-indent them to use a couple spaces, like
I did above, rather than using tabs. Your second line has 5 tabs(!) which on
many screens means 40 spaces!

The template above matches a 'person' element that has a 'label' parent,
'album' grandparent, and so on. It may not be necessary to specify anything
but 'person' in the match, unless there is a risk you would be processing
any 'person' elements that appear in different contexts.

> <track address="1 main street" telephone="(3333" email="e@xxxxxxx" web=""
> group="yes">joe doe</track>

> the idea was to have the track name appear as hyperlink with
> mailto:e@xxxxxxxx The top template works by itself, but how to
> include that function inside the track template?

Why would you want to invoke the template for 'person' elements? You didn't
quite explain what the correlation is between 'person' and 'track'. In fact, I
see no example of 'person' elements in your XML, so I can only assume that all
the info you need is in the 'track' element. Wouldn't this work (in your track 

<td align="right">
    <xsl:when test="contains(@email,'@')">
      <a href="mailto:{@email}";>
        <xsl:value-of select="."/>

   - Mike
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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

Current Thread


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.
First Name
Last Name
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.