It appears you are processing DocBook 5 documents
with the original non-namespaced version of the stylesheets. Because
DocBook 5 elements are in the DocBook namespace, they must first be stripped of
that namespace before that version of the stylesheets can match on the element
names. The internal stripping process basically converts a DocBook5
document to a DocBook4 document. That's where the ulink comes
from.
If you are processing DocBook5 documents, you can
avoid that problem of ulink conversion by switching to the namespaced version of
the DocBook XSL stylesheets. With those stylesheets, no conversion is
necessary and so there are no side effects from it. In general, that
is the recommended practice, as it avoids that conversion step. In that
case, your customization layer needs to add the namespace prefix to any
element names, as for example the d:link element in this example:
<xsl:when test="self::d:link and
@linkend">yellow</xsl:when>
See this reference for more
information:
----- Original Message -----
Sent: Thursday, December 17, 2009 9:27
AM
Subject: [docbook-apps] Antwort: Re:
[docbook-apps] Antwort: Re: [docbook-apps] DocBook 5 - different color for
hyperlinks in PDF output
Hello Johannes, hello
Scott,
many thanks for your quick
replies!
It turned out that
somehow the linking-element
<link xlink:href="someURL">hotlink</link>
is internally converted to ulink, that's
what the debugging-code from Johannes told me.
So I modified my customization layer like that:
<xsl:attribute-set
name="xref.properties">
<xsl:attribute name="color">
<!--<xsl:message>
<xsl:value-of select="concat('*** ',local-name(.))"/>"
</xsl:message>
<xsl:for-each select="@*">
<xsl:message>
<xsl:value-of select="concat('###
',namespace-uri(.),' - ',local-name(.))"/>
</xsl:message>
</xsl:for-each>-->
<xsl:choose>
<xsl:when test="self::link and
@linkend">yellow</xsl:when>
<xsl:when
test="self::ulink">green</xsl:when>
<xsl:when test="self::xref and @linkend">orange</xsl:when>
<xsl:when test="self::glossseealso and
@otherterm">grey</xsl:when>
<xsl:otherwise>blue</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
and it worked!
Now, of course I would love to know:
why?
Anyway, many thanks for your
help,
cheers,
Benno
Johannes Katelaan
<jk@e-integration.de>
17.12.2009 17:06
|
An
| benno.wolf@gi-de.com
|
Kopie
| docbook-apps@lists.oasis-open.org
|
Thema
| Re: [docbook-apps] Antwort: Re:
[docbook-apps] DocBook 5 - different color for hyperlinks in PDF
output |
|
Benno,
that's hard to say. What about adding debug code like
this to your xsl:attribute element:
<xsl:message>
<xsl:value-of select="concat('*** ',local-name(.))"/>
</xsl:message>
<xsl:for-each select="@*">
<xsl:message>
<xsl:value-of select="concat('###
',namespace-uri(.),' - ',local-name(.))"/>
</xsl:message>
</xsl:for-each>
This should give you sufficient
information to diagnose why it doesn't work as
expected.
Regards
Johannes
benno.wolf@gi-de.com schrieb:
I am sorry, but I tried that in
every possible constellation and with every xpath-expression known to man (me
;-) and it seems that every element and attribute can be resolved with the
exeption of exactly the xlink:href-attribute. Have a look at this:
<!-- macht die externen links in
pdfs blau, xrefs grün, see also links in glossaries grau --> <xsl:attribute-set
name="xref.properties">
<xsl:attribute name="color">
<xsl:choose>
<xsl:when test="self::link and
@linkend">grey</xsl:when>
<xsl:when test="self::link and @xlink:href">blue</xsl:when>
<xsl:when test="self::xref and @linkend">green</xsl:when>
<xsl:when test="self::glossseealso and @otherterm">grey</xsl:when>
<xsl:otherwise>black</xsl:otherwise>
</xsl:choose>
</xsl:attribute> </xsl:attribute-set>
What am I missing? Is it a namespace-problem with
xlink: ? I put the namespace on top of my customization layer:
<?xml version="1.0"?> <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" exclude-result-prefixes="#default">
What is wrong?
Regards, Benno
Yes, correct. So the
DocBook-5-Version would be as follows:
<xsl:attribute-set
name="xref.properties"> <xsl:attribute
name="color">
<xsl:choose>
<xsl:when test="self::d:link and
@xlink:href">blue</xsl:when>
<xsl:otherwise>inherit</xsl:otherwise>
</xsl:choose>
</xsl:attribute> <xsl:attribute
name="text-decoration">
<xsl:choose>
<xsl:when test="self::d:link and
@xlink:href">underline</xsl:when>
<xsl:otherwise>inherit</xsl:otherwise>
</xsl:choose>
</xsl:attribute> </xsl:attribute-set>
Thanks!
Johannes
Am 03.12.2009 um 18:02 schrieb
Bob Stayton:
> Yes, xref.properties usually affects all links.
However, an xsl:choose statement inside the attribute body can be more
selective, as the example in the referenced documentation shows. >
> Bob Stayton > Sagehill Enterprises > bobs@sagehill.net >
> > ----- Original Message ----- From: "Johannes Katelaan"
<jk@e-integration.de> > To: "Bob Stayton" <bobs@sagehill.net> > Cc: <docbook-apps@lists.oasis-open.org> > Sent: Thursday, December 03, 2009 8:58 AM > Subject: Re:
[docbook-apps] DocBook 5 - different color for hyperlinks in PDF
output > > > Hi Bob, > > it's intended only
for external links. I'm creating internal links using olink. These must not be
affected by this customization. So I think I may not use xref.properties. Is
this correct? > > Regards > > Johannes >
> Am 03.12.2009 um 17:47 schrieb Bob Stayton: > >>
Hi, >> The attribute-set named 'xref.properties' is available to add
properties like color to links. See this reference: >>
>> http://www.sagehill.net/docbookxsl/CustomXrefs.html#CustomXrefStyle >>
>> However, it isn't clear from your message if you indent this for
all links or only links to external documents. >> >> Bob
Stayton >> Sagehill Enterprises >>
bobs@sagehill.net >> >> >> ----- Original Message
----- From: "Johannes Katelaan" <jk@e-integration.de> >> To:
<docbook-apps@lists.oasis-open.org> >> Sent: Thursday, December
03, 2009 5:47 AM >> Subject: [docbook-apps] DocBook 5 - different
color for hyperlinks in PDF output >> >> >>>
Hi, >>> >>> how can I change the color of hyperlinks
created with >>> <link xlink:href="some url">text I want in
different color</link> >>> >>>
Johannes >>> >>> >>> >>>
--------------------------------------------------------------------- >>>
To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org >>> For additional
commands, e-mail: docbook-apps-help@lists.oasis-open.org >>>
>>> >> >> >>
--------------------------------------------------------------------- >>
To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org >> For additional
commands, e-mail: docbook-apps-help@lists.oasis-open.org >> >
> > > >
--------------------------------------------------------------------- >
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >
For additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org >
--------------------------------------------------------------------- To
unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For
additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For
additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
|