Next in thread → Next in month →

Re: Restricting topic - but would like to remove the db: prefix and thus far unable to

From
Alex Muir <>
Date
2013-08-13T20:52:28+00:00
ID
Thread
Re: Restricting topic - but would like to remove the db: prefix and thus far unable to
Well I found one solution to that problem.. by creating the equivalent rnc schema, this problem is alleviated. 

On Tue, Aug 13, 2013 at 1:36 PM, Alex Muir <> wrote:

Hi,

I'm defining an xsd which defines a restriction on topic. I include a portion of that here:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" 

  targetNamespace="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" 

  xmlns:xlink="http://www.w3.org/1999/xlink">
  
  <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/>

  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>

  <xs:element name="topic">

    <xs:complexType>

      <xs:sequence>
        <xs:element ref="db:info"/>
          <xs:element maxOccurs="unbounded" ref="db:para"/>
      </xs:sequence>
      <xs:attribute ref="db:metaref"/>

      <xs:attribute ref="db:role"/>
      <xs:attribute ref="xml:id" use="required"/>
    </xs:complexType>
  </xs:element>

 <xs:element name="para">

    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="db:emphasis"/>
        <xs:element ref="db:phrase"/>

      </xs:choice>
      <xs:attribute ref="db:metaref"/>
      <xs:attribute ref="db:role"/>
      <xs:attribute ref="xml:id"/>
    </xs:complexType>

  </xs:element>
...

The thing that I'm having trouble with is creating an output that does require the db: prefix on the attributes such as db:role db:metaref.  I've tried amoung other approaches removing the db: prefix from the xsd but things don't work out that way either.

It would be nice if the content validated against the DKCO.rnc as well which doesn't need the db:prefix

<?xml version="1.0" encoding="UTF-8"?>

<topic xmlns:xlink="http://www.w3.org/1999/xlink"  xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" xml:id="T1">

    <info>
        <title>Title</title>
    </info>
    
    <para db:role="XYZ" xml:id="T2">
        <phrase db:metaref="category">Location</phrase>

    </para>
</topic>

Thoughts?

Thanks

-- 

-

Alex Muir
http://ca.linkedin.com/pub/alex-muir/36/ab7/125

-- 

-

Alex Muir
http://ca.linkedin.com/pub/alex-muir/36/ab7/125
Next in thread → Next in month →