Subject: RE: [xsl] can templates be nested? From: "dmitri kerievsky" <dmitrik@xxxxxxxxxxxxxx> Date: Sun, 16 Jun 2002 12:50:43 -0400 |
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: [xsl] 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] can templates be nested?, Mike Brown | Thread | RE: [xsl] can templates be nested?, Joerg . Heinicke |
Re: [xsl] grouping with sub-total, Bill Curtis | Date | Re: [xsl] How to get and display pa, Joerg . Heinicke |
Month |