From: Artur H. <ko...@pl...> - 2003-08-30 13:37:43
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Well, I started to work on documentation, read what we have done and again search information about XML. Some time ago I had concern how to have one common document info included in each file such as: author, copyright and some other info but don't have this info repeated in master document at the beginning of each section in target format. The more I would like to be able to publish also each part as separate document and then, of course, I want this document info to be displayed. Now, I think I found a solution with use of xinclude and xpath. Let's assume we have or parts of our documentation in following form: (samplefile.xml) <section> <sectioninfo> <authorgroup> </authorgroup> <date> </date> <copyrigth> </copyright> </sectioninfo> <title></title> <abstract></abstract> <para></para> <para></para> <para></para> <'all other elements'/> <sectio></section> <sectio></section> <sectio></section> </section> Now we want to include in master document everything apart from <sectioninfo/> element with it's content. We can include content of above document apart from <sectioninfo/> with following command: <xi:include href="samplefile.xml#xpointer(/section/*[name()!='sectioninfo']/descendant-or-self::*)" xmlns:xi="http://www.w3.org/2001/XInclude" /> But above command includes only content of section - root element. If you want to have it as separate section in master document you have to embrace above command with <section> element. Artur - -- Artur Hefczyc "Don't change people, just live with them." Open Source Developer: http://www.geotools.org/ http://generguide.sourceforge.net/ http://wttools.sourceforge.net/ http://maven-plugins.sourceforge.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/UKh+0/6x1bjSKPkRAp+mAJ9jOGa3qzlt9t8zGXPLuWx3ZEjFWwCgpYMH 0KM4I6ZRyoykLZ5Q8b0tISs= =NyXw -----END PGP SIGNATURE----- |
From: Cameron S. <ca...@sh...> - 2003-08-31 03:17:27
|
On Saturday 30 Aug 2003 11:36 pm, Artur Hefczyc wrote: > Now we want to include in master document everything apart from > <sectioninfo/> element with it's content. > We can include content of above document apart from <sectioninfo/> > with following command: > <xi:include > href="samplefile.xml#xpointer(/section/*[name()!='sectioninfo']/descendant- >or-self::*)" xmlns:xi="http://www.w3.org/2001/XInclude" /> Good idea, I like it. -- Cameron Shorter http://cameron.shorter.net Open Source Developer http://generguide.sourceforge.net http://mapbuilder.sourceforge.net http://geotools.org Senior Software Engineer http://www.adi-limited.com |
From: Artur H. <ko...@pl...> - 2003-08-31 06:35:13
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 31 of August 2003 05:16, Cameron Shorter wrote: > On Saturday 30 Aug 2003 11:36 pm, Artur Hefczyc wrote: > > Now we want to include in master document everything apart from > > <sectioninfo/> element with it's content. > > We can include content of above document apart from <sectioninfo/> > > with following command: > > <xi:include > > href="samplefile.xml#xpointer(/section/*[name()!='sectioninfo']/descendan > >t- or-self::*)" xmlns:xi="http://www.w3.org/2001/XInclude" /> > > Good idea, I like it. I don't know if you know XPath, to effectively use above idea, XPath at least basic XPath knowledge is necessary and above sample looks complicated even for somebody familiar with it. (Probably there is simpler version of above expression.) I have found excellent site: http://www.zvon.org/xxl/XPathTutorial/General/examples.html and there is also self-training tool where you can experiment with XPath expressions: http://www.zvon.org:9001/saxon/cgi-bin/XLab/XML/xlabIndex.html?stylesheetFile=XSLT/xlabIndex.xslt Artur - -- Artur Hefczyc "Don't change people, just live with them." Open Source Developer: http://www.geotools.org/ http://generguide.sourceforge.net/ http://wttools.sourceforge.net/ http://maven-plugins.sourceforge.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/UZb80/6x1bjSKPkRAkEEAJ9GtzWDAGsI2Z6/uRBUdGYsVBy3zACfdtoY 1lDYisitUMRA5Kc8hlk9aM8= =/pXQ -----END PGP SIGNATURE----- |
From: Cameron S. <ca...@sh...> - 2003-08-31 09:28:04
|
On Sunday 31 Aug 2003 4:34 pm, Artur Hefczyc wrote: > I don't know if you know XPath, to effectively use above idea, XPath > at least basic XPath knowledge is necessary and above sample > looks complicated even for somebody familiar with it. Yes, I've been playing with Xpath and XSL recently. -- Cameron Shorter http://cameron.shorter.net Open Source Developer http://generguide.sourceforge.net http://mapbuilder.sourceforge.net http://geotools.org Senior Software Engineer http://www.adi-limited.com |
From: Cameron S. <ca...@sh...> - 2003-09-01 11:30:12
|
On Saturday 30 Aug 2003 11:36 pm, Artur Hefczyc wrote: > Now we want to include in master document everything apart from > <sectioninfo/> element with it's content. > We can include content of above document apart from <sectioninfo/> > with following command: > <xi:include > href="samplefile.xml#xpointer(/section/*[name()!='sectioninfo']/descendant- >or-self::*)" xmlns:xi="http://www.w3.org/2001/XInclude" /> Thinking again about how to remove <sectioninfo> from all the guides, it might be easier to run all the guides through a XSL filter which strips <sectioninfo> before calling the docbook parsing. This way, we don't need to edit the source guides. The stripping XSL could be called from generguide.sh. -- Cameron Shorter http://cameron.shorter.net Open Source Developer http://generguide.sourceforge.net http://mapbuilder.sourceforge.net http://geotools.org Senior Software Engineer http://www.adi-limited.com |
From: Artur H. <ko...@pl...> - 2003-09-01 12:03:47
|
> > Now we want to include in master document everything apart from > > <sectioninfo/> element with it's content. > > We can include content of above document apart from <sectioninfo/> > > with following command: > > <xi:include > > href="samplefile.xml#xpointer(/section/*[name()!='sectioninfo']/descendant- > >or-self::*)" xmlns:xi="http://www.w3.org/2001/XInclude" /> > Thinking again about how to remove <sectioninfo> from all the guides, it might > be easier to run all the guides through a XSL filter which strips > <sectioninfo> before calling the docbook parsing. This way, we don't need to > edit the source guides. The stripping XSL could be called from generguide.sh. Below text is to ensure that we are talking about the same thing. Please don't feel offended that I am repeating it again but I want to be sure we understand each other. Well, I didn't mean to remove <sectioninfo> from our guides. Just the opposite, I was thinking about adding it to all guides to have author, copyright, and so on... info included in all files. Because sometimes I would like to generate HTML page from only basicxml.xml document and sometimes I want basicxml.xml to be included as section in another large document. My concern was, how to include such files in master document without having <sectioninfo> content repeated at the beginning of each section in target XML file. Of course, the obvious solution is to omit <sectioninfo> during inclusion part content. But I didn't know if this is possible with <xinclude> element. The above sample shows how to accomplish this and include file content without unnecessary part. Artur -- Artur Hefczyc Open Source Developer http://generguide.sourceforge.net/ http://www.geotools.org/ http://wttools.sourceforge.net/ http://maven-plugins.sourceforge.net/ |