Importing a Schematron(blah.sch) from a directory into DocBo
Oxygen general issues.
Importing a Schematron(blah.sch) from a directory into DocBo
Hi,
I took overt this task to import several Schematrons into DocBook. I'm using oxygen XML Author. I guess previous who was task to do this said he tried to import but the schematron show unless they removed some tags, or something, for it to work. . .schematron would be displayed in our DocBook. can you help? Thanks!
I took overt this task to import several Schematrons into DocBook. I'm using oxygen XML Author. I guess previous who was task to do this said he tried to import but the schematron show unless they removed some tags, or something, for it to work. . .schematron would be displayed in our DocBook. can you help? Thanks!
Re: Importing a Schematron(blah.sch) from a directory into D
Sorry for the missing words.
Here is the request:
I took overt this task to import several Schematrons into DocBook. I'm using oxygen XML Author. I guess the previous person who was task to do this said he tried to import but the schematron wouldn't show in DocBook unless they removed some tags, or something, for it to work. . .schematron would be displayed in our DocBook. Can you help? Thanks!
Here is the request:
I took overt this task to import several Schematrons into DocBook. I'm using oxygen XML Author. I guess the previous person who was task to do this said he tried to import but the schematron wouldn't show in DocBook unless they removed some tags, or something, for it to work. . .schematron would be displayed in our DocBook. Can you help? Thanks!
Re: Importing a Schematron(blah.sch) from a directory into D
Hi,
It's not very clear to me what you're referring to when you say 'import several Schematrons into DocBook'. Schematrons are schema files and DocBook documents are XML content documents, so they don't really mix. You usually use Schematron to validate XML, so you would associate the schema with the document.
Do you want to associate the Schematron schema with the DocBook document in order to validate it?
You can do that within the DocBook document from menu > Document > Schema > Associate Schema and pick the Schematron schema.
Do you want to include the actual text content of the Schematron file in the DocBook document?
If that's it, you can use XInclude with @parse="text":
http://www.sagehill.net/docbookxsl/Modu ... ePlainText
e.g. Schematron schema listed in a 'programlisting' element in DocBook
Regards,
Adrian
It's not very clear to me what you're referring to when you say 'import several Schematrons into DocBook'. Schematrons are schema files and DocBook documents are XML content documents, so they don't really mix. You usually use Schematron to validate XML, so you would associate the schema with the document.
Do you want to associate the Schematron schema with the DocBook document in order to validate it?
You can do that within the DocBook document from menu > Document > Schema > Associate Schema and pick the Schematron schema.
Do you want to include the actual text content of the Schematron file in the DocBook document?
If that's it, you can use XInclude with @parse="text":
http://www.sagehill.net/docbookxsl/Modu ... ePlainText
e.g. Schematron schema listed in a 'programlisting' element in DocBook
Code: Select all
<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file:/path/to/my/file/schematron-schema.sch" parse="text"/></programlisting>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: Importing a Schematron(blah.sch) from a directory into D
Adrian ,
Yes, I need to import the actual text content of the Schematron file. We want to dynamically importing anything in a particular folder that contains all the schematron files and put in our DocBook which later will produce a PDF(we perform a MVN Install) which shows other information as well as the schematron content.
I will try to implement your solution.
Thanks!
Yes, I need to import the actual text content of the Schematron file. We want to dynamically importing anything in a particular folder that contains all the schematron files and put in our DocBook which later will produce a PDF(we perform a MVN Install) which shows other information as well as the schematron content.
I will try to implement your solution.
Thanks!
Re: Importing a Schematron(blah.sch) from a directory into D
TO make simple and to see if I am on the right path I simplified my problem. I tired a 1 small text file on my local drive. Text works.. . I can see the content when I product a PDF. I changed parse="xml" and only the tags appear.
This is the PDF output:
<Plan>
<MissionInfoSet>
<MissionInfo>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
</MissionInfo>
</MissionInfoSet>
</Plan>
Code: Select all
<title>***Schematron File Name***</title>
<para>
<xi:include
href="c:/SchTest/Test.xml" parse="xml"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:fallback>
<para><emphasis>FIXME: MISSING XINCLUDE CONTENT</emphasis></para>
</xi:fallback>
</xi:include>
</para>
This is the PDF output:
<Plan>
<MissionInfoSet>
<MissionInfo>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
</MissionInfo>
</MissionInfoSet>
</Plan>
Re: Importing a Schematron(blah.sch) from a directory into D
Hi,
You have two problems:
1. If you XInclude with @parse="xml", you won't obtain the content as text, but as the XML structure from the Schematron document, which is not valid in a DocBook document. You have to use @parse="text" to avoid the XML structure and instead obtain the text content.
2. If you put that XInclude in a para, the XIncluded content will get reformatted as any paragraph text and become unreadable. You want something similar to programlisting which preserves spaces and line breaks of the text content.
In addition to these, a less important but notable issue is that href has to be a URL, so for local files it should have the file protocol: file:/C:/....
Regards,
Adrian
You have two problems:
1. If you XInclude with @parse="xml", you won't obtain the content as text, but as the XML structure from the Schematron document, which is not valid in a DocBook document. You have to use @parse="text" to avoid the XML structure and instead obtain the text content.
2. If you put that XInclude in a para, the XIncluded content will get reformatted as any paragraph text and become unreadable. You want something similar to programlisting which preserves spaces and line breaks of the text content.
In addition to these, a less important but notable issue is that href has to be a URL, so for local files it should have the file protocol: file:/C:/....
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: Importing a Schematron(blah.sch) from a directory into D
Here is the entire code:
Test.xml content:
And the result of the generated PDF we output:
<Plan>
<MissionInfoSet>
<MissionInfo>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
</MissionInfo>
</MissionInfoSet>
</Plan>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>LIST OF EXAMPLES</title>
<para></para>
<sect1>
<title>Schematron Source</title>
<para></para>
<sect2>
<title>***Schematron File Name***</title>
<para>
<xi:include
href="c:/SchTest/Test.xml" parse="xml">
<xi:fallback>
<para><emphasis>FIXME: MISSING XINCLUDE CONTENT</emphasis></para>
</xi:fallback>
</xi:include>
*******PLACE CODE HERE FOR NOW**********************
</para>
</sect2>
</sect1>
</chapter>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="GenericCommPlan.xsd"
Name="Sample"
Description="Sample CP"
CreationDate="130000ZNOV2013" Version="0.1">
<MissionInfoSet>
<MissionInfo Name="ABCV1">
<Property Name="StartDate" Value="010000ZOCT2013"/>
<Property Name="LocationName" Value="ZZZZZ"/>
<Property Name="Long" Value="-17.000964"/>
<Property Name="Lat" Value="08.000051"/>
<Property Name="Radius" Value="1000"/>
</MissionInfo>
</MissionInfoSet>
</Plan>
And the result of the generated PDF we output:
<Plan>
<MissionInfoSet>
<MissionInfo>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
<Property></Property>
</MissionInfo>
</MissionInfoSet>
</Plan>
Re: Importing a Schematron(blah.sch) from a directory into D
Adrian,
I removed the parse="xml" and changed to parse="text"..also commented out the <para> and replaced it with <programlisting>. I like that it finally shows the content of the xml.
Oh ok...don't use href for local...ok.
I did chnage the test.xml or a schematron file and it worked too.
Now that I see it in the schematron content in the PDF doc, I notice it gets busy and can over run. . .I guess I need to set the margins or something.
See, our first intent was to have a DocBook. After doing a build, it will import all the schematron files and its content and into DocBook's xml page. We perform a Maven Install and DocBook would output a PDF. We didn't want to manually insert each schematron. I wonder if we set it like a image. We used to use this format
I removed the parse="xml" and changed to parse="text"..also commented out the <para> and replaced it with <programlisting>. I like that it finally shows the content of the xml.
Oh ok...don't use href for local...ok.
I did chnage the test.xml or a schematron file and it worked too.
Now that I see it in the schematron content in the PDF doc, I notice it gets busy and can over run. . .I guess I need to set the margins or something.
See, our first intent was to have a DocBook. After doing a build, it will import all the schematron files and its content and into DocBook's xml page. We perform a Maven Install and DocBook would output a PDF. We didn't want to manually insert each schematron. I wonder if we set it like a image. We used to use this format
Code: Select all
<sidebar>
<example>
<title>MUOSContactLists Example</title>
<screen>
<![CDATA[
<MissionInfoSet>
<MissionInfo Name="ABCV1">
<Property Name="StartDate" Value="010000ZOCT2013"/>
<Property Name="LocationName" Value="ZZZZZ"/>
<Property Name="Long" Value="-17.000964"/>
<Property Name="Lat" Value="08.000051"/>
<Property Name="Radius" Value="1000"/>
</MissionInfo>
</MissionInfoSet>
]]>
</screen>
</example>
</sidebar>
Re: Importing a Schematron(blah.sch) from a directory into D
I got it to import and show the content, on different test, of 1 XML and 1 schematron file from my local hard drive. Now, how would you import many files and its content to show in DocBook?
For 1 file I used: <xi:include href="file:///SchTest/Test.sch" parse="text">
What would be the syntax for multiple XML or schematron files in that directory?
For 1 file I used: <xi:include href="file:///SchTest/Test.sch" parse="text">
What would be the syntax for multiple XML or schematron files in that directory?
Re: Importing a Schematron(blah.sch) from a directory into D
Hi,
An XInclude can only refer one file at a time, so you'll have to use multiple XInclude statements for multiple files.
Note that you can even nest them, so you could set up an XML (can be generated with an XSLT) that contains all the XIncludes and then XInclude this XML into the DocBook document.
Regards,
Adrian
An XInclude can only refer one file at a time, so you'll have to use multiple XInclude statements for multiple files.
Note that you can even nest them, so you could set up an XML (can be generated with an XSLT) that contains all the XIncludes and then XInclude this XML into the DocBook document.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: Importing a Schematron(blah.sch) from a directory into D
Thanks Adrian,
Glad to know the answer to that. I did add more includes and that worked. Is there a way to get the content to be more left justify? I used </programlisting> to keep the content the way I usually see it, but the content is going off to the right when I generate it in a PDF.
Glad to know the answer to that. I did add more includes and that worked. Is there a way to get the content to be more left justify? I used </programlisting> to keep the content the way I usually see it, but the content is going off to the right when I generate it in a PDF.
Re: Importing a Schematron(blah.sch) from a directory into D
To add to this same scenario above, where I was able to hard code the location of the schematron and using the xinclude and href. Now, how do I make it more dynamic, no hard coded, if someone else performs a build and their workspace is different name, how would I find the schematron? Would I some how use href and an xpointer? If so, can I have an example?
Re: Importing a Schematron(blah.sch) from a directory into D
Hi,
If you keep the same relative folder structure among various users, you can use relative references in the XInclude @hrefs. e.g.
By default a relative reference is resoled relative to the file where the XInclude is used.
If you want to use a different base (than the file) for the relative references, you can specify xml:base="file:/absolute/path/to/folder/" on the parent or root element where the XIncludes are used.
Or, if you already have absolute URIs everywhere, you could use an XML catalog that rewrites these and point them to a new location (usually relative to the XML catalog file itself).
http://www.oxygenxml.com/doc/ug-editor/ ... alogs.html
e.g.
You can then add the XML catalog in Options > Preferences, XML > XML Catalog.
Regards,
Adrian
If you keep the same relative folder structure among various users, you can use relative references in the XInclude @hrefs. e.g.
Code: Select all
<xi:include href="relative/path/to/file.sch" parse="text">
If you want to use a different base (than the file) for the relative references, you can specify xml:base="file:/absolute/path/to/folder/" on the parent or root element where the XIncludes are used.
Or, if you already have absolute URIs everywhere, you could use an XML catalog that rewrites these and point them to a new location (usually relative to the XML catalog file itself).
http://www.oxygenxml.com/doc/ug-editor/ ... alogs.html
e.g.
Code: Select all
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="file:/absolute/path/to/folder/" rewritePrefix="./"/>
<rewriteSystem systemIdStartString="file:/absolute/path/to/folder/" rewritePrefix="./"/>
</catalog>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: Importing a Schematron(blah.sch) from a directory into D
Thanks all for the importing into DocBook help!!!!!!! All works! Sorry for the delay for this comments.
Re: Importing a Schematron(blah.sch) from a directory into D
I have now a related issue. Someone at work likes what we did with importing but this time he needs to import and display a html page, not the raw data, not the code, but the html page to be imported into DocBook. Of course we will us the "include"...but parse=Text, parse="html", doesn't work for what we want. Can someone help? Thanks again!
Re: Importing a Schematron(blah.sch) from a directory into D
When you include a file as text then that content is placed within a DocBook element as text. You cannot add HTML, XHTML or other XML content into a DocBook document. The schema will not allow that and also the XSLT stylesheets that process the document will not handle the new elements.
If your HTML content does not change in time then you can convert that to a DocBook section for example and include that section. The oXygen smart paste support may help you with this conversion.
The way to use HTML and DocBook together is to link from DocBook to the HTML file
having the HTML file made available at http://server/path/to/test.html.
Best Regards,
George
If your HTML content does not change in time then you can convert that to a DocBook section for example and include that section. The oXygen smart paste support may help you with this conversion.
The way to use HTML and DocBook together is to link from DocBook to the HTML file
Code: Select all
<link xlink:href="http://server/path/to/test.html">Link to an HTML file</link>
Best Regards,
George
George Cristian Bina
-
- Posts: 86
- Joined: Sun May 03, 2015 7:34 pm
- Location: San Francisco
Re: Importing a Schematron(blah.sch) from a directory into DocBo
Post by urbanrobots »
hi~ We are using DITA, but this conversation may still apply.
Our schematron file is getting too large, and we'd like to parse it into several, focused schematron files.
This code:
does not seem to work...
In the files, this error occurs:
Here is the "parent" schematron file header:
Here is the "child" schematron file header:
thanks, - nicholas
Our schematron file is getting too large, and we'd like to parse it into several, focused schematron files.
This code:
Code: Select all
<xi:include href="glossary_rules.sch" xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" />
In the files, this error occurs:
Where is this include information supposed to exist?cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://purl.oclc.org/dsdl/schematron":schema}'. One of '{"http://purl.oclc.org/dsdl/schematron":diagnostics, "http://purl.oclc.org/dsdl/schematron":pattern, "http://purl.oclc.org/dsdl/schematron":include, "http://purl.oclc.org/dsdl/schematron":extends, "http://purl.oclc.org/dsdl/schematron":title, "http://purl.oclc.org/dsdl/schematron":ns, "http://purl.oclc.org/dsdl/schematron":p, "http://purl.oclc.org/dsdl/schematron":let, "http://purl.oclc.org/dsdl/schematron":phase, WC[""], WC[##other:"http://purl.oclc.org/dsdl/schematron",""]}' is expected.
Here is the "parent" schematron file header:
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
queryBinding="xslt2">
<!-- Import the Glossary Schematron Rules -->
<xi:include href="glossary_rules.sch" xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" />
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
queryBinding="xslt2">
Re: Importing a Schematron(blah.sch) from a directory into DocBo
The xi:include element will be replaced with the root element of the document you include, so you will end up with sch:schema within sch:schema, which is invalid in Schematron, thus the error message that you get.
You can use:
to obtain what you want - assuming the Schematron implementation supports extends/@href and the oXygen implementation supports that.
Best Regards,
George
You can use:
Code: Select all
<sch:extends href="glossary_rules.sch"/>
Best Regards,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service