Hi all, I need to generate a number of XML Schemas having some XML documents as input (crazy, I know).
This is how I try to generate the root element of the schema: <xsl:param name="targetNS">http://a.com</xsl:param> <xsl:template match="/"> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="{$targetNS}" targetNamespace="{$targetNS}"> </schema> </xsl:template> Unfortunately the "{$targetNS}" expression in the xmln:tns attribute is not evaluated, thus the created schema is unusable (I can not reference types created for the target namespace). The other way would be to declare the target namespace as the default one in the schema, but that also fails. Is there a restriction for using XPath expressions for namespace declarations in the result document? Is there a way to a achieve my goal to generate a namespace declaration which is unknown at the time of writing the XSLT? Thank you in advance, Csaba p.s. I am attaching the XSLT, a sample input and the generated output files.
<?xml version="1.0" encoding="UTF-8"?><schema targetNamespace="http://a.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="{$targetNS}"/>
<root/>
schema-gen.xslt
Description: Binary data