This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]