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

RE: Test a node set based on an attribute that will ma

Subject: RE: Test a node set based on an attribute that will match a variable
From: "Ross, Douglas" <DRoss@xxxxxxxxxx>
Date: Thu, 20 Jan 2005 15:01:22 -0500
xsl test node
I suppose the version is unkown at compile time ...

If you know the version this might work:
<xsl:template
match="spec_off/offer[./@*[local-name()='version1']='true']">...</xsl:te
mplate>

<xsl:template
match="spec_off/offer[./@*[local-name()='version2']='true']">...</xsl:te
mplate>

etc.

Douglas Ross
Developer, HTML UI Framework
Kronos
E-mail: dross@xxxxxxxxxx
www.kronos.com

-----Original Message-----
From: Joris Gillis [mailto:roac@xxxxxxxxxx]
Sent: Thursday, January 20, 2005 3:01 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Test a node set based on an attribute that will match
a variable

> I also have this same need in a few templates... But that returns an
> error
>
> Variables may not be used within this expression.
> spec_off/offer[./@*[local-name()=-->$version<--]='true']
>
> syntax: <xsl:template
>
match="spec_off/offer[./@*[local-name()=$version]='true']">...</xsl:temp
late>
>
> Is this just illegal all around, or is there a way to have this work
too?

It's not possible to have variable references in match patterns.
You can probably avoid them by doing the test when you call the
template,
rather than in the match pattern.

e.g.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="version">CO</xsl:variable>

<xsl:template match="spec_off">
<xsl:apply-templates select="*[@*[local-name()=$version]='true']"/>
</xsl:template>

<xsl:template match="spec_off/*">
<xsl:text/>I'm an '<xsl:value-of select="local-name()"/>' node with a
true
'<xsl:value-of select="$version"/>' attribute.
</xsl:template>

</xsl:stylesheet>


regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid8041)
Spread the wiki (http://www.wikipedia.org)

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.