XSLT Type Checking

Posted by mo on Stack Overflow See other posts from Stack Overflow or by mo
Published on 2010-05-12T09:32:47Z Indexed on 2010/05/12 13:14 UTC
Read the original article Hit count: 154

Filed under:
|

Hi Folks

Is it possible to check an elements ComplexType?

i have this (simplified):

complexType Record
complexType Customer extension of Record
complexType Person extension of Record 

<xsl:template match="/">
    <records>
    <xsl:apply-templates /> 
    </records>
</xsl:template>

<xsl:template match="!!! TYPECHECK FOR RECORD !!!" name="Record">
   <record><xsl:value-of select="." /></record>
</xsl:template>

is it possible to check elementstype incl. inheritence?

i dont know the elements name only that they are a subtype of Record.

schema 1:
   complexType name="Customer"
      extension base="Record"

   element name="customers"
      element name="customer" type="Customer"

schema 2:
   complexType name="Person"
      extension base="Record"

   element name="persons"
      element name="person" type="Person"

schema ?:
   complexType name="UnknownType"
      extension base="Record"

   element name="unknowns"
      element name="unknown" type="UnknownType"

xml 1:
<customers>
   <customer />
   <customer />
</customers>

xml 2:
<persons>
   <person />
   <person />
</persons>

xml ?:
<?s>
   <? />
   <? />
</?s>

the xml input ist custom so i have to match by the type (i think)

© Stack Overflow or respective owner

Related posts about xslt

Related posts about casting