Subject: Re: [xsl] Looping through attributes.. From: "Joe Meree" <jmeree1@xxxxxxxxxxx> Date: Fri, 21 Mar 2003 08:21:45 -0500 |
From: David N Bertoni/Cambridge/IBM <david_n_bertoni@xxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Looping through attributes.. Date: Thu, 20 Mar 2003 14:34:31 -0800
> > > 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>
> > >
> > > Am I close???
> >
> > Yes:
> >
> > <xsl:for-each select="@*">
> > <xsl:if test="starts-with(.,'S')">
> > ...
> > </xsl:if>
> > </xsl:for-each>
> >
> > or even:
> >
> > <xsl:for-each select="@*[starts-with(.,'S')]">
> > ...
> > </xsl:for-each>
>
> whoa -- i just noticed that the original poster asked to select
> those attributes whose *names* started with 'S', not whose values
> started with 'S'.
>
> in case that's what he wanted, just use "starts-with(name(.), 'S')"
> instead. i think ...
Yes, you're right -- I replied without reading closely enough. Glad to see someone else did the same thing! ;-)
And since that's the case, local-name() might be more appropriate than name().
What's that about great minds thinking alike...
Dave
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Looping through attribute, Passin, Tom | Thread | Re: [xsl] Looping through attribute, Robert P. J. Day |
RE: [xsl] re xsl:Key, Michael Kay | Date | Re: [xsl] Looping through attribute, Robert P. J. Day |
Month |