XSLT 2.0 - Template Matching With Contains() -


i'm wondering if possible write template match contains() function.

i have document has multiple elements need renamed common element. of following need renamed op: op1.2, op7.3, op2.4, op5.6`, etc.

yes, can use contains() inside of predicate filter in match criteria elements.

<xsl:template match="*[contains(local-name(),'op')]>   <op>     <xsl:apply-templates select="@*|node()"/>   </op> </xsl:template> 

you use starts-with()

*[starts-with(local-name(),'op')] 

if using xslt 2.0 use matches() function, supports regex patterns more complex matching.

*[matches(local-name(),'^op')] 

Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -