Subject: Re: [xsl] can templates be nested? From: Mike Brown <mike@xxxxxxxx> Date: Sun, 16 Jun 2002 02:00:36 -0600 (MDT) |
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 template)? <td align="right"> <xsl:choose> <xsl:when test="contains(@email,'@')"> <a href="mailto:{@email}"> <xsl:value-of select="."/> </a> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> - 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] can templates be nested?, Joerg Heinicke | Thread | RE: [xsl] can templates be nested?, dmitri kerievsky |
RE: [xsl] trying to load xml and xs, Max Dunn | Date | Re: [xsl] How to get and display pa, Qinghui Zeng |
Month |