Topic
  • 2 replies
  • Latest Post - ‏2011-04-22T15:35:14Z by bergzilla
bergzilla
bergzilla
2 Posts

Pinned topic Can you use wildcards to match part of an attribute name?

‏2011-04-22T14:48:22Z |
Sorry if this is a stupid question but I've done some searching and I haven't found a way to do this.

I'd like to remove any attributes that match part of an attribute name

If I have attributes named foo, foo1, and foo2, I know that I can remove specific ones by doing

<xsl:template match="@foo | @foo1 | @foo2" />

but is there a way to do a partial match like

<xsl:template match="@foo*" />

I know that doesn't work since it was my first attempt.
Updated on 2011-04-22T15:35:14Z at 2011-04-22T15:35:14Z by bergzilla
  • SystemAdmin
    SystemAdmin
    1391 Posts

    Re: Can you use wildcards to match part of an attribute name?

    ‏2011-04-22T15:25:07Z  
    Like this.
    
    <xsl:template match=
    "@*[starts-with(name(),'foo')]" />
    
  • bergzilla
    bergzilla
    2 Posts

    Re: Can you use wildcards to match part of an attribute name?

    ‏2011-04-22T15:35:14Z  
    Like this.
    <pre class="jive-pre"> <xsl:template match= "@*[starts-with(name(),'foo')]" /> </pre>
    Perfect! Thank you very much!