You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Ferdinand Soethe <sa...@soethe.net> on 2005/03/17 19:48:05 UTC
Q: Combining grammars?
I have to write a dtd/schema/rng-grammar for a file that contains
partly structured information (the grammar for which I have already
written and placed in the project's resources/schema directory) and
partly free text that should validate against the document-v20-grammar.
<coursedata>
<structuredpart>
...
</structuredpart>
<webtext>
content in here should validate against document-v20
</webtext>
</coursedata>
Is there a way to simply reference that grammar in my grammer without
the complete document having to conform to document-v20?
Thanks
Ferdinand Soethe
Re: Q: Combining grammars?
Posted by Ferdinand Soethe <sa...@soethe.net>.
Johannes Schaefer wrote:
JS> This looks very much like what I've once used to
JS> extend the sdocbook DTD (see below).
JS> But I think you've got it running anyway by now.
No, I haven't. Does the dtd look right? Testing that is a bit
difficult as so many things could go wrong (and not be detected). So
somebody saying this way to do it is right would be much appreciated.
--
Ferdinand Soethe
Re: Q: Combining grammars?
Posted by Johannes Schaefer <jo...@uidesign.de>.
Ferdinand Soethe wrote:
> Johannes Schaefer wrote:
>
> JS> This looks very much like what I've once used to
> JS> extend the sdocbook DTD (see below).
> JS> But I think you've got it running anyway by now.
Copied your answer here, so that the code is present still.
See below.
> No, I haven't. Does the dtd look right? Testing that is a
> bit difficult as so many things could go wrong (and not be
> detected). So somebody saying this way to do it is right
> would be much appreciated.
Actually I tried this outside of Forrest as a proof of
concept. Using Saxon [1] I got an XML document that conforms
to my extended DTD [2] transformed to sDocBook and from
there to HTML/PDF.
I'm quite confident that this works inside Forrest as well.
You'll have to work out how to do the ENTITY resolution.
> <!ENTITY % sdocbook SYSTEM "sdocbook.dtd">
I simply copied the sdocbook stuff to the directory in which
I was experimenting and used SYSTEM.
>> FS> <!ENTITY % document PUBLIC
>> FS> "-//APACHE//ENTITIES Documentation V2.0//EN"
>> FS> "document-v20.mod">
You did the resolution with PUBLIC.
I don't know if this works. Try it out!
Maybe you can put it into a input-plugin?!
Cheers
Johannes
[1] http://saxon.sourceforge.net/
[2] see code snippet below
Johannes Schaefer wrote:
>
> This looks very much like what I've once used to
> extend the sdocbook DTD (see below).
> But I think you've got it running anyway by now.
>
> Johannes
>
>
[2]
> <!ENTITY % sdocbook SYSTEM "sdocbook.dtd">
> %sdocbook;
>
> <!-- title-less section: the title will be inserted by the stylesheet -->
> <!ENTITY % tlsection
> "sectioninfo?, (((%divcomponent.mix;)+, section*) | section+)">
>
>
> <!ELEMENT control ((%sect.title.content;), purpose, look, section*) >
>
> <!ELEMENT purpose (%tlsection;) >
> <!ELEMENT look (%tlsection;) >
[/2]
>
>
> Ferdinand Soethe wrote:
>
>> After some more reading ....
>>
>> Given this structure
>>
>> FS> <coursedata>
>> FS> <structuredpart>
>> FS> ...
>> FS> </structuredpart>
>> FS> <webtext>
>> FS> content in here should validate against document-v20
>> FS> </webtext>
>> FS> </coursedata>
>>
>> will this be ok for a dtd?
>>
>> FS> <?xml version="1.0" encoding="UTF-8"?>
>> FS> FS> FS> <!--
>> =============================================================== -->
>> FS> <!-- Include the Common ISO Character Entity Sets -->
>> FS> <!--
>> =============================================================== -->
>> FS> FS> <!ENTITY % common-charents PUBLIC
>> FS> "-//APACHE//ENTITIES Common Character Entity Sets V1.0//EN"
>> FS> "common-charents-v10.mod">
>> FS> %common-charents;
>> FS> FS> <!--
>> =============================================================== -->
>> FS> <!-- Document -->
>> FS> <!--
>> =============================================================== -->
>> FS> FS> <!ENTITY % document PUBLIC
>> FS> "-//APACHE//ENTITIES Documentation V2.0//EN"
>> FS> "document-v20.mod">
>> FS> %document;
>> FS> FS> <!-- webtext can have anything that body can in normal docs -->
>> FS> <!ELEMENT webtext (%sections; | %blocks;)+>
>> FS> FS> <!-- Need to define Elements of my structured part here -->
>> FS> FS> FS> <!-- My main structure -->
>> FS> <!ELEMENT coursedata (webtext | structuredpart )+>
>>
>> Thanks
>> Ferdinand Soethe
>>
>>
>
>
--
User Interface Design GmbH * Teinacher Str. 38 * D-71634
Ludwigsburg
Fon +49 (0)7141 377 000 * Fax +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH *
Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de
Buch "User Interface Tuning" von Joachim Machate & Michael
Burmester
www.user-interface-tuning.de
Besuchen Sie uns auf der Hannover Messe 11.-15. April 2005
Halle 2, Stand C14 auf dem MMI Gemeinschaftsstand
www.uidesign.de/hmi2005
Nächstes TAE-Seminar zu User Interface Design
Ostfildern-Nellingen, 07.-08. April 2005
www.tae.de TAE-Veranstaltung Nr. 31189
Re: Q: Combining grammars?
Posted by Johannes Schaefer <jo...@uidesign.de>.
This looks very much like what I've once used to
extend the sdocbook DTD (see below).
But I think you've got it running anyway by now.
Johannes
<!ENTITY % sdocbook SYSTEM "sdocbook.dtd">
%sdocbook;
<!-- title-less section: the title will be inserted by the
stylesheet -->
<!ENTITY % tlsection
"sectioninfo?, (((%divcomponent.mix;)+, section*) |
section+)">
<!ELEMENT control ((%sect.title.content;), purpose, look,
section*) >
<!ELEMENT purpose (%tlsection;) >
<!ELEMENT look (%tlsection;) >
Ferdinand Soethe wrote:
> After some more reading ....
>
> Given this structure
>
> FS> <coursedata>
> FS> <structuredpart>
> FS> ...
> FS> </structuredpart>
> FS> <webtext>
> FS> content in here should validate against document-v20
> FS> </webtext>
> FS> </coursedata>
>
> will this be ok for a dtd?
>
> FS> <?xml version="1.0" encoding="UTF-8"?>
> FS>
> FS>
> FS> <!-- =============================================================== -->
> FS> <!-- Include the Common ISO Character Entity Sets -->
> FS> <!-- =============================================================== -->
> FS>
> FS> <!ENTITY % common-charents PUBLIC
> FS> "-//APACHE//ENTITIES Common Character Entity Sets V1.0//EN"
> FS> "common-charents-v10.mod">
> FS> %common-charents;
> FS>
> FS> <!-- =============================================================== -->
> FS> <!-- Document -->
> FS> <!-- =============================================================== -->
> FS>
> FS> <!ENTITY % document PUBLIC
> FS> "-//APACHE//ENTITIES Documentation V2.0//EN"
> FS> "document-v20.mod">
> FS> %document;
> FS>
> FS> <!-- webtext can have anything that body can in normal docs -->
> FS> <!ELEMENT webtext (%sections; | %blocks;)+>
> FS>
> FS> <!-- Need to define Elements of my structured part here -->
> FS>
> FS>
> FS> <!-- My main structure -->
> FS> <!ELEMENT coursedata (webtext | structuredpart )+>
>
> Thanks
> Ferdinand Soethe
>
>
--
User Interface Design GmbH * Teinacher Str. 38 * D-71634
Ludwigsburg
Fon +49 (0)7141 377 000 * Fax +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH *
Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de
Buch "User Interface Tuning" von Joachim Machate & Michael
Burmester
www.user-interface-tuning.de
Besuchen Sie uns auf der Hannover Messe 11.-15. April 2005
Halle 2, Stand C14 auf dem MMI Gemeinschaftsstand
www.uidesign.de/hmi2005
Nächstes TAE-Seminar zu User Interface Design
Ostfildern-Nellingen, 07.-08. April 2005
www.tae.de TAE-Veranstaltung Nr. 31189
Re: Q: Combining grammars?
Posted by Ferdinand Soethe <sa...@soethe.net>.
After some more reading ....
Given this structure
FS> <coursedata>
FS> <structuredpart>
FS> ...
FS> </structuredpart>
FS> <webtext>
FS> content in here should validate against document-v20
FS> </webtext>
FS> </coursedata>
will this be ok for a dtd?
FS> <?xml version="1.0" encoding="UTF-8"?>
FS>
FS>
FS> <!-- =============================================================== -->
FS> <!-- Include the Common ISO Character Entity Sets -->
FS> <!-- =============================================================== -->
FS>
FS> <!ENTITY % common-charents PUBLIC
FS> "-//APACHE//ENTITIES Common Character Entity Sets V1.0//EN"
FS> "common-charents-v10.mod">
FS> %common-charents;
FS>
FS> <!-- =============================================================== -->
FS> <!-- Document -->
FS> <!-- =============================================================== -->
FS>
FS> <!ENTITY % document PUBLIC
FS> "-//APACHE//ENTITIES Documentation V2.0//EN"
FS> "document-v20.mod">
FS> %document;
FS>
FS> <!-- webtext can have anything that body can in normal docs -->
FS> <!ELEMENT webtext (%sections; | %blocks;)+>
FS>
FS> <!-- Need to define Elements of my structured part here -->
FS>
FS>
FS> <!-- My main structure -->
FS> <!ELEMENT coursedata (webtext | structuredpart )+>
Thanks
Ferdinand Soethe
Re: Q: Combining grammars?
Posted by Ferdinand Soethe <sa...@soethe.net>.
Ferdinand Soethe wrote:
FS> I have to write a dtd/schema/rng-grammar for a file that contains
FS> partly structured information (the grammar for which I have already
FS> written and placed in the project's resources/schema directory) and
FS> partly free text that should validate against the document-v20-grammar.
Never mind. I think I found the answer to my question when reading
about validation in http://forrest.apache.org/docs/validation.html.
Ferdinand Soethe