[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: multiple XML tags -> single output
Hello Zack, 1) to play with XPath expressions, try our XLab at: http://www.zvon.org/cgi-bin/xlab/bin/index.py 2) The construct: <xsl:template match="a"> <a href="<xsl:value-of select="@href"/>"><xsl:value-of select="."/></a> </xsl:template> is wrong. Use <xsl:template match="a"> <a href="{@href}"><xsl:value-of select="."/></a> </xsl:template> instead. Or <xsl:element> and <xsl:attribute>. Best regards Jirka zbrown@xxxxxxxxxxxxx wrote: > > 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 -- <name firstName="Jirka" surname="Jirat"/> <mail> jiratj@xxxxxxxxx </mail> <support> http://www.zvon.org </support> <zvonMailingList> http://www.zvon.org/index.php?nav_id=4 </zvonMailingList> 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
|