XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
XSD pattern facet that prohibits a simple type from containing acertain string?

Hi Folks,

 

Below is an excerpt of an XHTML document. It shows a <style> element. The content of the <style> element is printable ASCII text. I created this element declaration:

 

<xs:element name="style">
   
<xs:simpleType>
       
<xs:restriction base="xs:string">
           
<xs:maxLength value="40000" />
           
<xs:pattern value="[\s&#x20;-&#x7E;]*" />
       
</xs:restriction>
   
</xs:simpleType>
</xs:element>

 

But that is not sufficient. For my situation, a valid style element will not contain a <link> element inside the style element’s CDATA section. That is, if the style element is valid, the style element will not contain this:

 

<style>
    
<![CDATA[
       <link href="" type="text/css" rel="stylesheet" />
      ...
      -->]]>
</style>

 

Is there a way in XML Schema 1.0 to express the restriction: The value of the style element is a string, excluding &lt;link?

 

Perhaps a pattern facet with a regex like this:

 

<xs:pattern value="[\s&#x20;-&#x7E;-[(&lt;link0]]*" />

 

However, that’s not a legal regex.

 

I can express the restriction using Schematron:

 

<sch:assert test="not(matches(normalize-space(.), '.*&lt;link.*', 'i'))">
    …
</sch:assert>

 

But I would rather do all checking in XML Schema if possible.

 

Also, I could implement the restriction in XML Schema 1.1 using an xs:assert, but I would rather use XML Schema 1.0 if possible.

 

Is it possible to express the restriction in XML Schema 1.0?  /Roger

Excerpt of an XHTML document

 

<style>
    
<![CDATA[
      <!--
      /* Font Definitions */
      @font-face
      {
          font-family: "Cambria Math";
          panose-1: 2 4 5 3 5 4 6 3 2 4;
      }
      @font-face
      {
          font-family: Calibri;
          panose-1: 2 15 5 2 2 2 4 3 2 4;
      }
      /* Style Definitions */
      p.MsoNormal,
      li.MsoNormal,
      div.MsoNormal
      {
          margin: 0in;
          margin-bottom: .0001pt;
          font-size: 11.0pt;
          font-family: "Calibri", sans-serif;
      }
      a:link,
      span.MsoHyperlink
      {
          mso-style-priority: 99;
          color: #0563C1;
          text-decoration: underline;
      }
      a:visited,
      span.MsoHyperlinkFollowed
      {
          mso-style-priority: 99;
          color: #954F72;
          text-decoration: underline;
      }
      span.EmailStyle17
      {
          mso-style-type: personal-compose;
          font-family: "Calibri", sans-serif;
          color: windowtext;
      }
      .MsoChpDefault
      {
          mso-style-type: export-only;
          font-family: "Calibri", sans-serif;
      }
      @page WordSection1
       {
          size: 8.5in 11.0in;
          margin: 1.0in 1.0in 1.0in 1.0in;
      }
      div.WordSection1
      {
          page: WordSection1;
      }
      -->]]>
</style>

 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS