xsl-list
[Top] [All Lists]

Re: [xsl] Selecting all elements which have an attribute that matches a given pattern

2010-08-18 05:18:52
Etheridge, Stephen wrote:

I have an XML file (a schema in fact) that is many thousands of lines
long and I need to edit it (i.e transform it).  There are numerous
elements of type <xs:element> all of which have a "name" attribute.
Some of those name attributes end with the string "List", e.g.
"MilkTypeList".  For those elements, I want to apply a template to add
an additional <xs:element>.  I am having great trouble crafting the
correct "match" for my <xsl:template>.  I have tried contains() and
matches() but my editor (Oxygen) states that those cannot be used as a
pattern and my reading supports that.  Can anyone help?

You can certainly use e.g.
  <xsl:template match="xs:element[contains(@name, 'List')]">
or
  <xsl:template match="xs:element[matches(@name, 'list', 'i')]">

--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>