On Tue, Apr 12, 2005 at 09:48:41AM +0200, Hussein Shafie wrote:
> The if() function is a ``proprietary'' extension. These extensions are
> documented in
> http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch07s01.html
>
> Note that the snippet sent by Jan could be rewritten as because the if()
> is in fact a if/elsif/elseif/elseif/.../else:
>
> ---
> xref {
> content: icon(left-link)
> xpath("if(id(@linkend)/@xreflabel, id(@linkend)/@xreflabel,\
> id(@linkend)/title, id(@linkend)/title,\
> id(@linkend)/glossterm, id(@linkend)/glossterm,\
> @linkend)");
> vertical-align: text-top; /* for the icon */
> color: navy;
> }
> ---
Aha, that makes sense; I never noticed that section about XPath
extension functions. Thank you for pointing it out, and for pointing
out the structure of the if() function.
> ---
> PS: In the snippet sent by Jan, displaying id(@linkend)/title seems
> obvious, but why add id(@linkend)/glossterm? Why not add even more
> elements? Is this what is done in Norman Walsh's XSLT style sheets?
I'm not exactly sure what algorithm the DocBook-XSL distribution uses,
but I think Jan's idea was that if an xref is pointing to a glossentry,
then the text representing that xref should be the glossterm that that
glossentry is defining. I've come up with my own version which makes
this explicit and which handles cross-referencing to bibliographic
entries in a particular way:
---
xref {
/* NOTE: This uses a proprietary XXE XPath extension. */
content: xpath("\
if((id(@linkend)/self::biblioentry or id(@linkend)/self::bibliomixed) \
and \
id(@linkend)/@xreflabel, concat('[', id(@linkend)/@xreflabel, ']'), \
id(@linkend)/self::biblioentry or id(@linkend)/self::bibliomixed, \
concat('[', @linkend, ']'), \
id(@endterm), concat('\201c ', id(@endterm), '\201d '), \
id(@linkend)/@xreflabel, \
concat('\201c ', id(@linkend)/@xreflabel, '\201d '), \
id(@linkend)/title, concat('\201c ', id(@linkend)/title, '\201d '), \
id(@linkend)/self::glossentry, id(@linkend)/glossterm, \
concat('[', @linkend, ']'))");
color: navy;
}
---
Notes: This implementation formats bibliographic entry references as
[Label]. The "\201c " and "\201d " are the CSS-escaped Unicode
characters for the left double quote and the right double quote,
respectively. Finally, if an xref makes it through all the way to the
default condition, then we also use the [Label] formatting since we're
not sure what sort of object lies at the other end.
I'm attempting to be compliant both with DocBook: The Definitive Guide
and the behavior that I experience from the DocBook-XSL distribution.
Naturally, season to taste. And feel free to let me/the list know if
you make general-purpose modifications to this.
Take care,
John L. Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20050419/30752a2b/attachment.sig