[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
Tom That is similar to what I need, except that I do not want to have to insert the filename into each file. I have A LOT of files and sections and the filenames and what sections they Xinclude are still in flux. However, just for fun I stuck the xml:base in and it extracted SOME of the filenames. This is a start, but I wonder what happened to the other? It looks like they disappeared when the second level sction was encountered in a file. I am assuming there is a way to do this, as the HTML stylesheets insert the filename#id in the TOC. If I have to dig at them, then I must. But compared to all of the XSL brains on this list, I am but a single celled organism ;-) I am SLOWLY learning all of the XSL stuff but I was hoping that I had just missed a line in the documentation that said how to do this. I am including the whole template here for better context. Dean Nelson -------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- Clear all other text templates --> <xsl:template match="text()"/> <!-- Main ADP template --> <xsl:template match="book"> <assistantconfig version="3.2.0"> <profile> <property name="name">EdgeUserManual</property> <property name="title">EDGE 5 User Manual</property> <property name="applicationicon">./images/eeclogoletter.gif</property> <property name="startpage">html/index.html</property> <property name="aboutmenutext">About EDGE 5</property> <property name="abouturl">html/e5man.html</property> <property name="assistantdocs">/usr/local/qt/doc/html/</property> </profile> <DCF ref="html/index.html" icon="images/eeclogo.png" title="EDGE 5 User Manual"> <section ref="html/{@xml:base}.html" title="{title}" > <xsl:text> </xsl:text> <xsl:apply-templates/> </section> <xsl:text> </xsl:text> </DCF> </assistantconfig> </xsl:template> <!-- Select top level items --> <xsl:template match="section | chapter | appendix | part"> <section ref="html/{@xml:base}.html" title="{title}" > <xsl:text> </xsl:text> <xsl:apply-templates/> </section> <xsl:text> </xsl:text> </xsl:template> <!-- Select children --> <xsl:template match="section//section"> <section ref="html/{@xml:base}.html" title="{child::title} " /><xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> -----Original Message----- From: tom_schr@web.de [mailto:tom_schr@web.de] Sent: Thursday, January 11, 2007 2:22 PM To: docbook-apps@lists.oasis-open.org 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 --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]