Subject: Re: [xsl] multiple XML tags -> single output From: zbrown@xxxxxxxxxxxxx Date: Wed, 27 Dec 2000 21:30:01 -0800 |
On Wed, Dec 27, 2000 at 09:05:29PM -0700, Mike Brown wrote: > zbrown@xxxxxxxxxxxxx wrote: > > OK, the docs I've got say that '//issue' will match all <issue> elements > > anywhere in the document. As opposed to 'issue' which only matches children > > in the current context. > > True, but... > > <xsl:value-of select="//issue/@num"/> > > Here you are selecting the 'num' attribute of *all* issue elements in the > document. > > xsl:value-of takes the string-value of its select attribute and makes a > text node out of it in the result tree. Check the XPath spec and see that > the string-value of a node-set is the string-value of only the *first* > node in the set. > > So no matter what the current node is, this will only ever give you the > value of the first num attribute of the first issue element that has one. > Is this really what you want? I see... well, at the moment it is, but I could see wanting to change it, or use a more selective construction for something else in the future. For now though, <title> and <issue> are not really related to each other syntactically, except by what the output wants. So it really does have to take the first instance that's available. > > Also, the concat() function is standard XPath/XSLT and will work with your > processor. You just need to be sure the paths are correct. Doing 3 > xsl:value-of instructions in a row is relatively wasteful. Well, I've tried but it doesn't seem to work... that part of the XSL file doesn't produce any output at all when I use concat(). I've also noticed an interesting error, maybe only due to XML::XSLT, where an XML snippet containing <a href="URL">text</a> will crash the module if I use an XSL snippet like this: <xsl:template match="a"> <a href="<xsl:value-of select="@href"/>"><xsl:value-of select="."/></a> </xsl:template> The above looks OK to me, but my script returns not well-formed at line 47, column 17, byte 1320 at /usr/lib/perl5/5.005/i386-linux/XML/Parser.pm line 168 and dies. (line 47 is that very part of the XSL file) Zack > > - Mike > ____________________________________________________________________ > Mike J. Brown, software engineer at My XML/XSL resources: > webb.net in Denver, Colorado, USA http://skew.org/xml/ > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > -- -- Zack Brown, Linuxcare, Inc. tel: 1-415-354-4878x284, fax: 1-415-701-7457 zbrown@xxxxxxxxxxxxx, http://www.linuxcare.com/ Linuxcare. Support for the revolution. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] multiple XML tags -> sing, Mike Brown | Thread | Re: [xsl] multiple XML tags -> sing, Jiri Jirat |
Re: [xsl] multiple XML tags -> sing, Mike Brown | Date | [xsl] SORTING XML FILE WITH JS, Sachidanandam E.K |
Month |