Re: Has anyone got examples of these validating XSLTs? Was: Re: DTD F iles !

Subject: Re: Has anyone got examples of these validating XSLTs? Was: Re: DTD F iles !
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 May 2000 17:55:39 +0100 (BST)
> Surely XML Schema is more suitable for those who are disatisfied with DTDs?

`more suitable' depends on what constraints your are trying to enforce.
The types of constraint that you can express using xpath are different.

For example in MathML a cn element (number) normally just takes
character data (as a real number) but if the the type attribute is used
with value complex-cartesian then the cn element has to have exactly one
<sep/> child, with the real and imaginary parts being represented by the
characters either side of the <sep/>.

You can't express this in a DTD (and I don't think you can in a schema
either)  but 


<xsl:template 
  match="m:cn[@type='complex-cartesian' and not(count(m:sep)=1)]">
<xsl:message>don't do this</xsl:message>
</xsl:template>


<xsl:template 
  match="m:cn[m:sep and not(@type)]">
<xsl:message>don't do this either</xsl:message>
</xsl:template>

David


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


Current Thread