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

Re: Accessing attributes

Subject: Re: Accessing attributes
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Sat, 10 Aug 2002 00:17:38 +0200
accessing attributes in xslt
Hello Carlos,

both answers until now seem to be incorrect. I assume, that you are only missing current():

<xsl:when test="/site/dadosPasseio/correlato/item[@correlato = current()/@idPasseio]">

A snippet of the corresponding XML often will help, but here it was easy, because you are not the first with this problem.

May I suggest you a shorter version in general:

<xsl:for-each select="site/passeio/item">
<option value="{@idPasseio}">
<xsl:if test="/site/dadosPasseio/correlato/item[@correlato = current()/@idPasseio]">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
</option>
</xsl:for-each>


Furthermore you avoid duplicate code.

Regards,

Joerg

Carlos Durand wrote:
Hi all,

How can I access an attribute value inside an if and
for-each functions?

For example

<xsl:for-each select="site/passeio/item">


<xsl:choose> <xsl:when test="/site/dadosPasseio/correlato/item[@correlato = @idPasseio]"> <option value="{@idPasseio}" selected="selected"><xsl:value-of select="@passeio"/></option> </xsl:when> <xsl:otherwise> <option value="{@idPasseio}" ><xsl:value-of select="@passeio"/></option> </xsl:otherwise> </xsl:choose>



</xsl:for-each>

@correlato belongs to if and @idPasseio belongs to
for-each...

Thanks

Durand


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.