Thanks for that.
I'm having difficulty getting the desired effect, though (either with
params or attribute sets), which I think is due to my
misunderstanding of Xpath query syntax. I've constructed a very
small case that illustrates my misunderstanding.
Within an attribute-set, the following evaluates as true
<xsl:when test="/book">
But the following does not:
<xsl:when test="/book/info[1]">
nor does
<xsl:when test="/book/info">
I would have thought that, since my <book> contains an <info>
element, that the second and third expressions would each return one
node, and thus evaluate to true. This understanding is based on the
following example from the W3 XPath specification (http://www.w3.org/
TR/xpath#path-abbrev)
"/doc/chapter[5]/section[2] selects the second section of the fifth
chapter of the doc"
I'm sure that I'm making a very basic error here - could someone help
me clarify my understanding?
Thanks,
Geraint North
Principal Engineer
Transitive
* The leader in cross-platform virtualization
This E-mail and any attachments hereto are strictly confidential and
intended solely for the addressee. If you are not the intended
addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to
any third party without the prior consent of the sender.
On 13 Dec 2007, at 21:05, Bob Stayton wrote:
Hi,
Keep in mind that a top level parameter is processed once only,
when the stylesheet is loaded. As such, a parameter is good for
global properties. For properties on elements with different
attributes or content, you can use something similar in the value
of an attribute inside an attribute-set. For an example of that
syntax, see:
http://www.sagehill.net/docbookxsl/PrintTableStyles.html#TableTitle
An attribute-set is evaluated each time it is used on an element,
so the condition can resolve differently for different element
instances.
Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]
----- Original Message ----- From: "Geraint North"
<[EMAIL PROTECTED]>
To: "Thomas Schraitle" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Thursday, December 13, 2007 12:29 AM
Subject: Re: [docbook-apps] Something like an attribute-set, but
different
That's great - I didn't realise that the parameters could be
dynamically configured in that way (but of course they can be,
thinking about it) - that will make life very easy indeed.
Thanks,
Geraint North
Principal Engineer
Transitive
On 12 Dec 2007, at 19:29, Thomas Schraitle wrote:
Hi,
On Mittwoch, 12. Dezember 2007, Geraint North wrote:
I've got a few situations where I'd like to set some attributes
based
on some top-level properties of my DocBook Book. For example:
- If the <book>'s lang is "ja", use a set of Japanese fonts, rather
than the defaults.
That's pretty easy. You have to create a customization layer as
shown in
[1] and insert the following parameter:
<xsl:param name="body.font.family">
<xsl:choose>
<xsl:when test="/book/@lang='ja'">
<xsl:text><!-- Insert your fonts here --></xsl:text>
</xsl:when>
<xsl:otherwise>serif</xsl:otherwise>
</xsl:choose>
</xsl:param>
Probably you need to configure the other parameters like
sans.font.family
as well (see [2]).
- If the confidentiality level of the document (my own tag) is
"Confidential", print the chapter titles in black rather than blue.
For this check I need to know where your confidentiality element is
allowed.
I am not 100% sure, maybe there are better methods, but you can
change the
attribute set chapter.titlepage.recto.style (untested):
<xsl:attribute-set name="chapter.titlepage.recto.style">
<xsl:attribute name="color">
<xsl:choose>
<!-- Adapt the XPath in test to your needs -->
<xsl:when test="/*/confidentiality = 'Confidental'">
<xsl:text>black</xsl:text>
</xsl:when>
<xsl:otherwise>blue</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
Insert it into your customization layer too. :)
Hope that helps,
Tom
---------
[1]
http://www.sagehill.net/docbookxsl/
CustomMethods.html#CustomizationLayer
[2] http://docbook.sourceforge.net/release/xsl/current/doc/fo/
fonts.html
--
Thomas Schraitle
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
open.org
For additional commands, e-mail: [EMAIL PROTECTED]
open.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
open.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
open.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]