xml - xslt: match partial attribute name -


any xslt version should do.

assuming attributes :

<tag attr-something="1" attr-something-else="1" attr-something-more="1" attr-different="1" attr-thing="1"> 

what's simplest way match attributes names start attr-something ?

this matches 1 specific attribute :

<xsl:template match="@attr-something"/> 

this matches hardcoded list of attributes :

<xsl:template match="@attr-something|@attr-something-else"/> 

this matches nodes contain attribute[s] start required string :

<xsl:template match="*[starts-with(name(@*), 'attr-something')]"/> 

but how match attributes ?

to match attributes partial name can use:

<xsl:template match="@*[starts-with(name(), 'attr-something')]"> ... 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -