[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: can templates be nested?
question about : i'm trying to have an xml/xsl document work in netscape , and it does not seem to. if already works in ie. Any idea how this can be done? this is the init code: src = new ActiveXObject("Msxml2.DOMDocument.4.0"); src.async = false; src.load("pagl.xml"); ss = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.4.0'); ss.async = false; ss.load("Catalog.xsl"); cache = new ActiveXObject("Msxml2.XSLTemplate.4.0"); cache.stylesheet = ss; createLists(); thanks, dmitri -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mike Brown Sent: Sunday, June 16, 2002 4:01 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: can templates be nested? 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|