Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - RE: Conditional Levels of a Schema >Thread Next - RE: Conditional Levels of a Schema RE: Conditional Levels of a SchemaTo: xmlschema-dev@--.--- Date: 4/6/2009 11:41:00 PM
In case someone is going to need it, here is Pete's suggestion:
The Master Schema
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="0.3"
xmlns:hrm="http://www.hrmconsensus.org/layers">
<xs:element name="xhrm">
<xs:complexType>
<xs:sequence>
<xs:element name="device" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="patient"
type="xs:string" hrm:patientInfo="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Use xsl to convert it to a another xsd where patient info is required. I
tried to use result-document with it, but could not get the syntax correct.
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hrm="http://www.hrmconsensus.org/layers">
<xsl:output method="xml" indent="no"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="@hrm:patientInfo">
<xsl:attribute name="minOccurs">
<xsl:value-of select="1"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
--
View this message in context: http://www.nabble.com/Conditional-Levels-of-a-Schema-tp22905179p22929208.html
Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.
From mike@s... Tue Apr 07 14:21:59 2009
Received: from bart.w3.org ([128.3 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
