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

RE: Looping through attributes..

Subject: RE: Looping through attributes..
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Thu, 20 Mar 2003 17:12:50 -0500
RE:  Looping through attributes..
[Karl Stubsjoen]
> 
> Okay, I'm looping through attributes.  Now I need to 
> determine if the name
> of an attribute starts with a particular text expression.  I have the
> following (and it doesn't work):
> 
> <xsl:for-each select="@*">
> <xsl:if test="starts-with(@,'S')">
> ...
> </xsl:if>
> </xsl:for-each>
> 

How you might wanat to do this could depend on what you really awnt to
accomplish and whether those attribute names might change from time to
time, or might be contained somewhere in the source xml document.

I would look at selecting just the attributes that you want.  If you
want to look for several different strings, and perhaps you would want
to pass these strings in as parameters in the future,  it could go like
this -

<xsl:variable name='att1' select='"S"'/>
<xsl:variable name='att2' select='ID'/>

<xsl:for-each select='@*[starts-with(name(.),$att1)]
   | @*[starts-with(name(.),$att2)]'>
   ...
</xsl:for-each>

Cheers,

Tom P

 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.