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

xsl:attribute (was Re: URL query as table data)

Subject: xsl:attribute (was Re: URL query as table data)
From: Antonio Bueno <atnbueno@xxxxxxxxxx>
Date: Sun, 17 Feb 2002 18:10:48 +0100
xsl url attribute
Hello, everybody.

WARNING: XSLT newbie here.

Mike answered to Harry:
MB> Never mind. This is what you're trying to do:
MB>   <A>
MB>     <xsl:attribute name="HREF">
MB>       <xsl:text>http://lookuphost.com/bin/lookup.cgi?term=</xsl:text>
MB>       <xsl:apply-templates/>
MB>     </xsl:attribute>
MB>     <xsl:apply-templates/>
MB>   </A>

I've tried to do the same but instead of A and HREF I was using OPTION
and VALUE. And it didn't work.

I wanted to transform
    <canal id="CP">Canal +</canal>
into
    <option value="CP">Canal +</option>

I'm using MSXML4 and this worked:

<xsl:template match="canal">
    <option>
        <xsl:value-of select="."/>
    </option>
</xsl:template>

But with this I only get:
    <option>Canal +</option>

Then I tried to apply Mike's answer:
    
<xsl:template match="canal">
    <option>
        <xsl:attribute name="value">
            <xsl:value-of select="@id"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
    </option>
</xsl:template>

But it didn't work (the VBScript transformNode() method I'm using gave
me a numeric error).

This is what finally worked:

<xsl:template match="canal">
    <xsl:element name="option">
        <xsl:attribute name="value">
            <xsl:value-of select="@id"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
    </xsl:element>
</xsl:template>

Why doesn't xsl:attribute works in the first try?
Is it something specific from MSXML4?

Thanks in advance
and greetings from Spain
 Antonio

http://www.webcsd.com
mailto:atnbueno@xxxxxxxxxx


 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.