[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|