[xsl] Schema Exploration...

Subject: [xsl] Schema Exploration...
From: Mark Diggory <mdiggory@xxxxxxxxxxxxxxxxx>
Date: Thu, 18 Apr 2002 14:07:58 -0400
I'm trying to select a schema element node relative to the current xs:element node I've referenced in a parameter ($schema_node). The problem is that there are several cases that need to be checked for:

xs:element/*[@name='test1a' or @ref='test1b']
xs:element/xs:complexType/xs:choice/*[@name='test2a' or @ref='test2b']
xs:element/xs:complexType/xs:sequence/*[@name='test3a' or @ref='test3b']

...
  <xs:element name="test1">
     <xs:element name="test1a"/>
     <xs:element ref="test1b"/>
  </xs:element>

  <xs:element name="test2">
     <xs:complexType>
         <xs:choice>
            <xs:element name="test2a"/>
            <xs:element ref="test2b"/>
            ...
         </xs:choice>
      </xs:complexType>
  </xs:element>

  <xs:element name="test3">
     <xs:complexType>
	<xs:sequence>
            <xs:element name="test3a"/>
            <xs:element ref="test3b"/>
             ...
         </xs:sequence>
      </xs:complexType>
  </xs:element>
...

I'm struggling to get an pattern that will match all these cases, currently I have one case matched and working:

<xsl:param name="node_name" select="name()"/>

<xsl:apply-templates select="
$schema_node/xs:element[@name=$node_name or @ref=$node_name]
"/>

I'm not sure how I would expand this case to include the other ones.

-Mark



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


Current Thread