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

Linux vanilla kernel on QEMU and networking with eth0 -

rdbms - what exactly the undo information lives in oracle? -

clojure - 'get' replacement that throws exception on not found? -