W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2009

RE: Conditional Levels of a Schema

From: Dieter Menne <dieter.menne@menne-biomed.de>
Date: Tue, 7 Apr 2009 06:41:10 -0700 (PDT)
Message-ID: <22929208.post@talk.nabble.com>
To: xmlschema-dev@w3.org

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"
	<xs:element name="xhrm">
				<xs:element name="device" type="xs:string"/>
				<xs:element minOccurs="0" maxOccurs="1" name="patient" 
				   type="xs:string" hrm:patientInfo="1"/>

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"
  <xsl:output method="xml" indent="no"/>
  <xsl:template match="node()|@*">
      <xsl:apply-templates select="@*"/>

  <xsl:template match="@hrm:patientInfo">
    <xsl:attribute name="minOccurs">
      <xsl:value-of select="1"/>

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.
Received on Tuesday, 7 April 2009 13:41:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:51 UTC