List Info

Thread: v5 extension elements




v5 extension elements
user name
2007-09-05 03:24:45
I found it easy enough to create a reduced docbook set.

wondering about extending it.

I need to add an element into the basic inlines?


  <define name="db.ubiq.inlines">
     <choice>
       <choice>
         <ref name="db.inlinemediaobject"/>
         <ref name="db.remark"/>
         <ref name="db.superscript"/>
         <ref name="db.subscript"/>
         <ref name="db.link.inlines"/>
         <ref name="db.alt"/>
	<ref name="shLft"/>
	<ref name='shRt'/>
       </choice>
       <ref name="db.annotation"/>
       <ref name="db.indexterm"/>
     </choice>
   </define>


Then by own definitions of shLft and shRt.

Is there any better way of doing this please?



regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-05 10:02:25
Dave Pawson wrote:
> I found it easy enough to create a reduced docbook
set.
> 
> wondering about extending it.
> 
> I need to add an element into the basic inlines?
> 
> 
>  <define name="db.ubiq.inlines">
>     <choice>
>       <choice>
>         <ref
name="db.inlinemediaobject"/>
>         <ref name="db.remark"/>
>         <ref name="db.superscript"/>
>         <ref name="db.subscript"/>
>         <ref name="db.link.inlines"/>
>         <ref name="db.alt"/>
>     <ref name="shLft"/>
>     <ref name='shRt'/>
>       </choice>
>       <ref name="db.annotation"/>
>       <ref name="db.indexterm"/>
>     </choice>
>   </define>
> 
> 
> Then by own definitions of shLft and shRt.
> 
> Is there any better way of doing this please?

 <define name="db.ubiq.inlines"
combine="choice">
  <choice>
    <ref name="shLft"/>
    <ref name='shRt'/>
  </choice>
</define>

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34
member
------------------------------------------------------------
------

Re: v5 extension elements
user name
2007-09-05 10:55:01
Jirka Kosek wrote:
> Dave Pawson wrote:
>> I found it easy enough to create a reduced docbook
set.
>>
>> wondering about extending it.
>>
>> I need to add an element into the basic inlines?

>>
>> Is there any better way of doing this please?
> 
>  <define name="db.ubiq.inlines"
combine="choice">
>   <choice>
>     <ref name="shLft"/>
>     <ref name='shRt'/>
>   </choice>
> </define>
> 

In an external file Jirka.. then include the main db file?

Sounds 'smarter' than my way!

Thanks.


regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-17 05:11:04
Dave Pawson wrote:
> Jirka Kosek wrote:
>> Dave Pawson wrote:
>>> I found it easy enough to create a reduced
docbook set.
>>>
>>> wondering about extending it.
>>>
>>> I need to add an element into the basic
inlines?
> 
>>>
>>> Is there any better way of doing this please?
>>
>>  <define name="db.ubiq.inlines"
combine="choice">
>>   <choice>
>>     <ref name="shLft"/>
>>     <ref name='shRt'/>
>>   </choice>
>> </define>
>>
> 
> In an external file Jirka.. then include the main db
file?
> 
> Sounds 'smarter' than my way!


Trying the same, with a block level element and I'm getting
all sorts of trouble.

My customization is

<include
href="/sgml/docbook/v5/docbookxi.rng">
   <define name="db.para.blocks"
combine="interleave">
     <ref name="Fragment"/>
   </define>
</include>




<define name="Fragment">
   <element name="fragment" ns="ht
tp://nwalsh.com/xmlns/litprog/fragment">
     <zeroOrMore>
       <attribute>
	<anyName/>
       </attribute>
     </zeroOrMore>
     <ref name="foreign-elements"/>
   </element>
</define>

<define name="foreign-elements">
   <zeroOrMore>
     <element>
       <anyName>
	
       </anyName>
       <zeroOrMore>
	<attribute>
	<anyName/>
	</attribute>
       </zeroOrMore>
       <text/>
     </element>
   </zeroOrMore>
</define>


I.e. I want an 'any element' option to the para level block
elements.

1. If I try this jing tells me

/files/litprog/litprog.rng:45:14: error: conflicting
ID-types for 
attribute "linkend" of element "msginfo"
from namespace 
"http://docbook.or
g/ns/docbook"

which I'm led to believe is the RELAX NG DTD Compatibility
issue.
so I try
$ jing  -i litprog.rng litprog.xweb

and I get

/files/litprog/litprog.xweb:36:11: error: element
"para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context
/files/litprog/litprog.xweb:42:9: error: element
"para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context
/files/litprog/litprog.xweb:44:9: error: element
"para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context
/files/litprog/litprog.xweb:56:9: error: element
"para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context
/files/litprog/litprog.xweb:59:9: error: element
"para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context
/files/litprog/litprog.xweb:62:29: error: element
"element" from 
namespace "http://rela
xng.org/ns/structure/1.0" not allowed in this
context


I.e. I can't have any para elements within a section?

I don't understand how the two are related.

Any suggestions please - other than forget the
customization,
which is where I am now.

TIA





-- 
Dave Pawson
XSLT, XSL-FO and Docbook FAQ
http://www.dpawson.co.uk



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-17 15:15:31
Dave Pawson wrote:

> 1. If I try this jing tells me
> 
> /files/litprog/litprog.rng:45:14: error: conflicting
ID-types for
> attribute "linkend" of element
"msginfo" from namespace
> "http://docbook.or
g/ns/docbook"
> 
> which I'm led to believe is the RELAX NG DTD
Compatibility issue.
> so I try

Don't use your "foreign-elements" pattern, instead
use "db._any" pattern
which is predefined in DocBook schema. This pattern excludes
elements
from known namespaces (like DocBook NS) so there is no
ambiguity in
validation and thus also not conflicting datatypes for
attributes.

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34
member
------------------------------------------------------------
------

Re: v5 extension elements
user name
2007-09-18 01:45:15
Jirka Kosek wrote:
> Dave Pawson wrote:
> 
>> 1. If I try this jing tells me
>>
>> /files/litprog/litprog.rng:45:14: error:
conflicting ID-types for
>> attribute "linkend" of element
"msginfo" from namespace
>> "http://docbook.or
g/ns/docbook"
>>
>> which I'm led to believe is the RELAX NG DTD
Compatibility issue.
>> so I try
> 
> Don't use your "foreign-elements" pattern,
instead use "db._any" pattern
> which is predefined in DocBook schema. This pattern
excludes elements
> from known namespaces (like DocBook NS) so there is no
ambiguity in
> validation and thus also not conflicting datatypes for
attributes.


OK, thanks Jirka.

I'll take a look at it too!

regards


-- 
Dave Pawson
XSLT, XSL-FO and Docbook FAQ
http://www.dpawson.co.uk



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-20 07:07:16
Further effort to extend, this time a block level element.

<include
href="/sgml/docbook/v5/docbook.rng">
   <define name="db.para.blocks"
combine='choice'>
     <oneOrMore>  <ref name="poem"/>
</oneOrMore>
   </define>
</include>

<!-- DP Addition -->
<include href="poem.rng"/>



I have a chapter/section/poem element, i.e.
I want the poem to go wherever a para could go.

Jing reports

x.xml:14:9: error: element "para" from namespace 
"http://docbook.or
g/ns/docbook" not allowed in this context

para is a preceding-sibling of poem.

Any suggestions please.


regards

-- 
Dave Pawson
XSLT, XSL-FO and Docbook FAQ
http://www.dpawson.co.uk



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-20 08:58:39
Dave Pawson wrote:
> Further effort to extend, this time a block level
element.
> 
> <include
href="/sgml/docbook/v5/docbook.rng">
>   <define name="db.para.blocks"
combine='choice'>
>     <oneOrMore>  <ref
name="poem"/> </oneOrMore>
>   </define>
> </include>

Nesting define inside include works like redefinition. Your
schema
should look like:

<include ...docbook.rng/>

<include ...poem.rng/>

<define name="db.para.blocks"
combine="choice">
  ...
</define>

Or you can simply add this last define directly inside
poem.rng.

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34
member
------------------------------------------------------------
------

Re: v5 extension elements
user name
2007-09-20 09:32:14
Jirka Kosek wrote:
> Dave Pawson wrote:
>> Further effort to extend, this time a block level
element.
>>
>> <include
href="/sgml/docbook/v5/docbook.rng">
>>   <define name="db.para.blocks"
combine='choice'>
>>     <oneOrMore>  <ref
name="poem"/> </oneOrMore>
>>   </define>
>> </include>
> 
> Nesting define inside include works like redefinition.

Which is what (I thought) I was doing Jirka?
Adding (another choice) to the existing definition?


  Your schema
> should look like:
> 
> <include ...docbook.rng/>
> 
> <include ...poem.rng/>
> 
> <define name="db.para.blocks"
combine="choice">
>   ...
> </define>

Works perfectly!
Why isn't this a redefinition... in fact what is it
if it isn't a redefinition please?


> 
> Or you can simply add this last define directly inside
poem.rng.


Even simpler, though I like the idea of a simple
'customization'
file, just as I do with XSLT. Makes for a simple model.


Thanks Jirka.

regards


-- 
Dave Pawson
XSLT, XSL-FO and Docbook FAQ
http://www.dpawson.co.uk



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: v5 extension elements
user name
2007-09-20 09:39:36
Dave Pawson wrote:
> Jirka Kosek wrote:
>> Dave Pawson wrote:
>>> Further effort to extend, this time a block
level element.
>>>
>>> <include
href="/sgml/docbook/v5/docbook.rng">
>>>   <define name="db.para.blocks"
combine='choice'>
>>>     <oneOrMore>  <ref
name="poem"/> </oneOrMore>
>>>   </define>
>>> </include>
>>
>> Nesting define inside include works like
redefinition.
> 
> Which is what (I thought) I was doing Jirka?
> Adding (another choice) to the existing definition?

IIRC define inside include *replaces* original definition in
included
schema and combine="choice" is effectively ignored
in this case. So you
removed para (and other para-like elements) from
db.para.blocks and left
only poem here.

>> <include ...docbook.rng/>
>>
>> <include ...poem.rng/>
>>
>> <define name="db.para.blocks"
combine="choice">
>>   ...
>> </define>
> 
> Works perfectly!
> Why isn't this a redefinition... in fact what is it
> if it isn't a redefinition please?

It's not complete redefinition, just addition achieved by
combine.

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34
member
------------------------------------------------------------
------

[1-10]

about | contact  Other archives ( Real Estate discussion Medical topics )