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

Re: Display value AND apply templates

Subject: Re: Display value AND apply templates
From: "Drew McLellan" <dru@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2003 05:21:50 -0700
xsl display value
Thanks Simon, and David, for your replies.

That was just what I was looking for.

Drew


---------- Original Message ----------------------------------
From: "Simon Kelly" <kelly@xxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Date:  Mon, 11 Aug 2003 13:55:24 +0200

>Try this
>
><xsl:template match="/">
>    <xsl:apply-templates />
></xsl:template>
>
><xsl:template match="para">
>    <p>
>        <xsl:apply-templates />
>    </p>
></xsl:template>
>
><xsl:template match="chem">
>    <span class="chem>
>        <xsl:apply-templates />
>    </chem>
></xsl:template>
>
><xsl:template match="sub">
>    <sub>
>        <xsl:apply-templates />
>    </sub>
></xsl:template>
>
><xsl:template match="text()">
>    <xsl:value-of select="." />
></xsl:template>
>
>----- Original Message ----- 
>From: "Drew McLellan" <dru@xxxxxxxxxxxxxxxxxxxx>
>To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
>Sent: Monday, August 11, 2003 1:45 PM
>Subject:  Display value AND apply templates
>
>
>> I've been looking at this for too long and can no longer think clearly.
>Take this example:
>>
>> <myxml>
>>     <para>The notation for water is
>>         <chem>H
>>             <sub>2</sub>
>>         0
>>         </chem>
>>     </para>
>> </myxml>
>>
>> I'm trying to transform to XHTML. The desired output for the above would
>be:
>>
>> <p>The notation for water is <span class="chem">H<sub>2</sub>0</span></p>
>>
>> The problem I have is that if I use value-of "." I can get the value of
>node, but no further templates are applied. If I use apply-templates "*" I
>get the sub-templates but no value.
>>
>> For example:
>>
>> <xsl:template match="chem">
>>     <span class="chem"><xsl:apply-template select="*" /></span>
>> </xsl:template>
>>
>> <xsl:template match="sub">
>>     <sub><xsl:value-of select="." /></sub>
>> </xsl:template>
>>
>> This gets the <sub> but loses the value of the <chem>.
>>
>> As I say, I've lost all clarity of mind on this, so I'm expecting it to be
>obvious! Any and all suggestions most welcome.
>>
>> Thanks for your time.
>>
>> Drew McLellan
>>
>>
>>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>
>>
>
>
> 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

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.