OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] How to extract name of XML file


Hi Dean,

On Thursday 11 January 2007 21:04, Nelson, Dean wrote:
>
> One of my tasks is to connect the Docbook HTML files to our
> documentation system that uses QT Assistant.
>
> I have written a short stylesheet that does this - almost. Here is the
> path that I took:
> 1. search each section for the ID and title in the XML file
> 2. format the output in the simple XML ADP style.
>
> I used the ID as my base of my filename which worked for 90% of the
> info. However, some of IDs did not correspond to a file because they
> were included as subsections in the XML file.

In general, there is no function available in XSLT that can extract the 
filename of the corresponding XML file. However, there are other "tricks" 
how you can solve your problem.


> Here is what I used:
>
>           <xsl:template match="section | chapter | appendix | part">
> ----->  <section ref="html/{@id}.html" title="{title}" > <xsl:text>
>
>         </xsl:text>
>         <xsl:apply-templates/>
>         </section> <xsl:text>
>         </xsl:text>
>           </xsl:template>

I hope I understood your problem, so please correct me if I am on a 
complete wrong track. :)
I don't know which DocBook version do you use, but 4.3 and above provides 
the xml:base attribute. I use this occasionally to insert the XML 
filename. I am not sure if this is the real intention but it works. :)


> What I want the marked line to say is some thing like this:
> <section ref="html/{Name_Of_XML_File}#{@id}" title="{title}" >
> [...]

You could insert the xml:base in your DocBook file, for example:

  <sect1 xml:base="foo.xml" ...>

With XSLT you can extract this:

 <section ref="html/{@xml:base}#{@id}" title="{title}" >

However, you have to make sure that the xml:base attribute and the 
filename always stay the same, otherwise it won't work.

It's just a crazy idea, I don't know if it is what you was searching for.


Best wishes,
Tom


-- 
Thomas Schraitle


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]