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

Subject: Re: [xsl] Selecting all elements which have an attribute that matches a given pattern
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 18 Aug 2010 12:18:35 +0200
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/

Current Thread