xsl-list
[Top] [All Lists]

RE: Global, dynamically-named variables (or equiv) in XSL

2003-06-19 12:56:57
Hi,

I don't know what you are trying to do but taking a stab, I would say you
want to set a key:

<xsl:key name="types" match=" xs:simpleType | xs:complexType" use="@name"/>

Forget about the variable try. Simply match the xs:element and get the base
datatype there through the key:

<xsl:template match="xs:element">
  <xsl:value-of select="key('types', @type)/xs:restriction/@base"/>
</xsl:template>

Does that do it for you?

Best,
-Rob


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-
list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of Mark Miller
Sent: Thursday, June 19, 2003 12:00 PM

Hi,

I'm working with an XML Schema document (.xsd), and I'm having trouble
dealing with the idea of types and references to them.  My example xsd
(from w3schools) creates several named types, e.g.

<xs:simpleType name="stringtype">
 <xs:restriction base="xs:string"/>
</xs:simpleType>

which are then referenced elsewhere in the document like this:

...
  <xs:element name="orderperson" type="stringtype"/>
...




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