xsl-list
[Top] [All Lists]

Complex type as the 'xsl:variable/@as' value

2005-11-17 09:27:39
  Hi

  I use simply a variable, like this:

    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                   xmlns:my="http://www.fgeogres.org/dummy";
                   version="2.0">

      <xsl:output method="text"/>

      <xsl:variable name="list" select="/my:list" as="my:list_type"/>

      <xsl:import-schema schema-location="saxon-static-analysis.xsd"
                         namespace="http://www.fgeogres.org/dummy"/>

      <xsl:template match="schema-element(my:list)">
        <xsl:value-of select="my:elem[1]"/>
        <xsl:text>&#10;</xsl:text>
      </xsl:template>

    </xsl:transform>

  Saxon-SA 8.6, in validation mode, says:

    Error at xsl:variable on line 7 of saxon-static-analysis.xsl:
      XPST0003: SequenceType syntax error at char 0 in {my:list_type}:
        Type (my:list_type) is a complex type

  Here is the associated XML Schema:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
               xmlns:my="http://www.fgeogres.org/dummy";
               targetNamespace="http://www.fgeogres.org/dummy";>

      <xs:complexType name="list_type">
        <xs:sequence>
          <xs:element ref="my:elem" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:complexType>

      <xs:simpleType name="elem_type">
        <xs:restriction base="xs:string">
          <xs:enumeration value="val1"/>
          <xs:enumeration value="val2"/>
        </xs:restriction>
      </xs:simpleType>

      <xs:element name="list" type="my:list_type"/>
      <xs:element name="elem" type="my:elem_type"/>

    </xs:schema>

  Is it not possible to use a complex type as the content of
a variable?  Why?

  Thanks,

--drkm



















        

        
                
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--