[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: multiple XML tags -> single output

Subject: Re: multiple XML tags -> single output
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 28 Dec 2000 01:05:08 -0700 (MST)
multiple xml attribute text
zbrown@xxxxxxxxxxxxx wrote:
> 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().

concat() *will* work, if you fix the XPath expressions. The example I
posted was slightly wrong because in my haste I didn't look at your
original XML; I made the mistake of assuming that the person who had
suggested multiple <xsl:value-of>s had the correct expressions.

I apologize for not giving you a perfect answer. The idea was to show you
how to produce the text you wanted using one xsl:value-of instruction, not
to do your homework for you.

>     <xsl:template match="a">
>         <a href="<xsl:value-of select="@href"/>"><xsl:value-of select="."/></a>
>     </xsl:template>

This is wrong because XSL is XML, and XML has rules of well-formedness
that you violated when you said that an element (the first
xsl:value-of) was another element's attribute value (the href="...").

XSLT offers a convenient syntax for calculating the values of attributes
in a literal result element... curly braces:

<a href="{@href}">
  <xsl:value-of select="."/>
</a>

A more verbose syntax is to create the literal result element and add its
attribute via a separate instruction:

<a>
  <xsl:attribute name="href">
     <xsl:value-of select="@href"/>
  </xsl:attribute>
  <xsl:value-of select="."/>
</a>

You are not going to get very far if you think of <xsl:value-of> as a
macro that results in text string substitution. You would do well to learn
what XSLT is really doing. 

Nodes are not tags, and tags are not literal text strings that you
are serially pasting together to produce the output you want.

   - 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.