Question

So I have about 100 types of XML files, most of them use a different xmlns for the same nodes. Now I want to transform these XML files using XSLT, and it workes great. Except I need one XSL for each XML, and the only difference is the xmlns, the nodes I want are the same. (I don't make the XML)

I know that I can pass parameters to my XSL from Scala, but since I need to declare the parameter, I can not use it when defining the root node.

So, is there any way to dynamically set the xmlns for the XSTL?

Était-ce utile?

La solution

XSLT 2.0 allows you to write e.g.

<xsl:template match="*:foo">...</xsl:template>

to match elements with local name foo in any namespace. Saxon 9 is an XSLT 2.0 processor for instance.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top