[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Generating schema target namespaces from XSLT

Subject: Generating schema target namespaces from XSLT
From: Danny Vint <dvint@xxxxxxxxxxxxxx>
Date: Fri, 01 Nov 2002 13:02:28 -0800
xslt targetnamespace
I have an XML format that we use to define our standard that is processed with XSLT to generate a DTD or Schema based upon that format. Everything has been ok until we added the target namespace to the schema. I can parameterize the target attributes value, but I haven't found a way to general the corresponding xmlns attribute to go with it without hardcoding the value. Does anyone have a workaround?

Here is the relavent postion of the stylesheet:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
      xmlns:xml="http://www.w3.org/XML/1998/namespace"
      xmlns:saxon="http://icl.com/saxon"
      extension-element-prefixes="saxon"
      xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
      >

<xsl:param name="target" select="'http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/'"/>


<xsl:template match="/"> <!-- START Schema Output -->

<xsd:schema>
<xsl:attribute name="elementFormDefault">unqualified</xsl:attribute>
<xsl:attribute name="attributeFormDefault">unqualified</xsl:attribute>
<xsl:attribute name="targetNamespace"><xsl:value-of select="$target"/></xsl:attribute>
<xsl:attribute name="version"><xsl:value-of select="ACORD-XML-DOC/@version"/></xsl:attribute>
</xsl:template>
</xsl:stylesheet>


This produces the following Schema:

<xsd:schema
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
	elementFormDefault="unqualified" attributeFormDefault="unqualified"
	targetNamespace="http://www.ACORD.org/standards/PC_Surety/ACORD1.2.0/xml/"
	version="1.2.0"
>

I can get the targetNamespace attribute set, but becasue the namespace has to be identified on the <stylesheet> attribute I can't use a parameter there to set this value to be the same - thus I have to hard code it.

..dan
---------------------------------------------------------------------------
Danny Vint
http://www.dvint.com





XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.