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: [Fwd: [Fwd: Re: [docbook-apps] Trouble with value-of and node selection]]


Perfect!

Thanks for all your help Bob, you're doing a great job.

Geoff

-------- Original Message --------
Subject: Re: [docbook-apps] Trouble with value-of and node selection
Date: Tue, 11 Oct 2005 23:20:29 -0700
From: Bob Stayton <bobs@sagehill.net>
To: Geoff Purchase <lists@userdox.com>
References: <434CA13D.4050904@userdox.com>

You're close, but the select statement needs work.  The context element for
which the template user.footer.navigation is called is the chapter, section,
article, etc. element that starts the current chunk. The releaseinfo element
is not an ancestor (container) of any chunk element, so that simple XPath
never works.

So you need to create a select xpath that finds the right releaseinfo for
each chunk element in your document tree.   Something like this should work:

  <xsl:value-of select="ancestor-or-self::*[child::*/releaseinfo][1]
                    /child::*/releaseinfo[1]"/>

Breaking this down into steps:

1.  Select the current element and all of its ancestors.
2.  Qualify that by selecting only those that have a child (some info
element)
that contains a releaseinfo element.
3.  Take the first (closest) ancestor or self that meets the previous
criteria. You can use [1] since ancestors are counted backwards from the
current element, with self being first.
4. So far you have selected the closest ancestor element, and now you have
to actually get its releaseinfo element inside its *info child
5. And take just the first one of those in case there is more than one in
the info child.

You may need to adjust this a bit if it doesn't work in all cases.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message -----
From: "Geoff Purchase" <lists@userdox.com>
To: "docbook-apps" <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, October 11, 2005 10:38 PM
Subject: [docbook-apps] Trouble with value-of and node selection


> Hi,
>
> I'm hoping I can give you all enough information to point me in the
> right direction with this.
>
> This is a restating of my earlier problem with subversion keyword
> substitution after some feedback from Claus Rasmussen.  Thanks to the
> feedback I have a better understanding of what it is I'm trying to
> achieve - but not a full understanding...
>
> What I'm trying to achieve is the inclusion of the value-of releaseinfo
> from each article in the chunked output html files.  For example, the
> article background.xml is broken into 8 chunks and I would like the line
> $Id: background.xml 555 2005-10-11 23:33:16Z gmp0 $ to be included in
> the footer of each chunk.  The article maintenance.xml is broken into 7
> chunks and I would like the line $Id: maintenance.xml 508 2005-10-03
> 14:04:12Z gmp0 $ in the footer of each of these chunks.
>
>  From Claus I tried modifying my user.footer.navigation template without
> success:
>
> <xsl:template name="user.footer.navigation">
>    <xsl:param name="node" select="."/>
>    <p class="Footer"> Authorised by ...</p>
>    <p class="revisiondate">
>      <xsl:value-of select="ancestor::releaseinfo[1]"/>
>    </p>
> </xsl:template>
>
> The failure is the value-of not being included.  The generated html
> files include the line <p class="revisiondate"></p>.
>
> I have also tried using ancestor-or-self::releaseinfo[1] without success.
>
> Following the example at
> http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#HTMLHeaders I can
> include the releaseinfo data from book/bookinfo in the footer of every
> html file, but this does not reflect the commit date of the article that
> contains the content being displayed.
>
> The details of my project are:
>
> In book.xml (DTD 4.3) I have:
>
> <book>
>   <title>Foo</title>
>   <bookinfo>
>    ...
>    <releaseinfo>$Id: book.xml 525 2005-10-11 09:48:16Z gmp0 $</releasinfo>
>   </bookinfo>
>   <preface>
>    ...
>   </preface>
>   <xi:include href="background.xml" .../>
>   <xi:include href="maintenance.xml" .../>
>   ...
>   <xi:include href="glossary.xml" .../>
> </book>
>
> In each of my articles I have:
>
> <article>
>   <title>Foo2</title>
>   <articleinfo>
>    <releaseinfo>$Id: background.xml 555 2005-10-11 23:33:16Z gmp0
> $</releaseinfo>
>   </articleinfo>
> ...
> </article>
>
>
> The $Id is a keyword substitution that occurs when each file is
> committed to the Subversion repository.  Each file has unique $Id value.
>
> I have a lot of customisations spread throughout several different xsl
> files.  When I transform this book to html I call the
> html_custom_layer.xsl file which has the following lines:
>
> 1 <xsl:import href="http://...url.../docbook/xsl/html/chunk.xsl"/>
> 2 <xsl:import href="http://...url.../custom/itr_custom_layer.xsl"/>
> 3 <xsl:import href="http://...url.../custom/itr_html_custom_layer.xsl"/>
> 4 <xsl:import href="custom_layer.xsl"/>
>
> Where:
> 1 is the 1.68.1 stylesheet
>
> 2 contains department wide customisations for all outputs
>   - formal.title.placement
>   - xref.with.number.and.title
>   - use.role.for.mediaobject
>   - customised labelling for articles
>   - localisation for article custom labels
>
> 3 contains department wide html only customisations
>   - admon.*
>   - navig.*
>   - supress.(footer/header.)navigation 0
>   - template user.header.navigation
>   - template user.footer.navigation
>   - template header.navigation
>   - template footer.navigation
>
> 4 contains book only customisations
>   - draft.mode
>
>
>
>
> Some extra things I looked at:
>
> In user.footer.navigation I have tried using preceding::releaseinfo[1]
> with some success, see ASCII art below
>
> |------article1-($Id1)--|-----article2--($Id2)--|
> |-file1-|-file2-|-file3-|-file4-|-file5-|-file6-|
> |-no$Id-|-$Id1--|-$Id1--|-$Id1--|-$Id2--|-$Id2--|
>
> When I tried using following::releaseinfo[1] in user.footer.navigation
> it was different again...
>
> |------article1-($Id1)--|-----article2--($Id2)--|
> |-file1-|-file2-|-file3-|-file4-|-file5-|-file6-|
> |-$Id2--|-$Id2--|-$Id2--|-$Id3--|-$Id3--|-$Id3--|
>
>
>
>
> Geoff
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>




-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/126 - Release Date: 9/10/2005





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