RE: [docbook-apps] XInclude in sitemap problem

2008-08-16 Thread Mauritz Jeanson
 -Original Message-
 From: [EMAIL PROTECTED] 
 
 I'm using Xalan-2.7.0 with Xerces-2.7.1 and docbook-xsl-1.73.2.

[...]

 Is there any way to force the docbook stylesheets not to use 
 named entities for the target db?
 Are there any other tricks?


With Xalan, you can use the xalan:entities extension attribute on the
xsl:output element. To completely disable output of entity references,
create an empty file and let the attribute value point to that file:

xsl:output encoding=UTF-8
xalan:entities=somefile/

See http://xml.apache.org/xalan-j/usagepatterns.html#outputprops.

/MJ



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [docbook-apps] XInclude in sitemap problem

2008-08-15 Thread mercuron
Hi,

I found a solution that might be worth for inclusion in the docbook-xsl distro.
Basically I enclose everything of the ttl and xreftext sections of a target db 
in a CDATA section. (common/targets.xsl) 
Then I ensure that the output of the xreftext is not xml encoded. 
(common/olink.xsl).

Cheers,
Marco


?xml version='1.0'?
!-- customization layer for overloading templates of the common section --
xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xmlns:fo=http://www.w3.org/1999/XSL/Format;
version='1.0'

!-- overload template div and obj from common/targets.xsl --
!-- enclose content of ttl and xreftext in CDATA section -- 
xsl:template name=div
  xsl:param name=nd select=./
  div
xsl:call-template name=attrs
  xsl:with-param name=nd select=$nd/
/xsl:call-template
ttl
  xsl:text disable-output-escaping=yeslt;![CDATA[/xsl:text
xsl:apply-templates select=$nd mode=title.markup
  xsl:with-param name=verbose select=0/
/xsl:apply-templates
  xsl:text disable-output-escaping=yes]]gt;/xsl:text
/ttl
xreftext
  xsl:text disable-output-escaping=yeslt;![CDATA[/xsl:text
xsl:choose
  xsl:when test=$nd/@xreflabel
xsl:call-template name=xref.xreflabel
  xsl:with-param name=target select=$nd/
/xsl:call-template
  /xsl:when
  xsl:otherwise
xsl:apply-templates select=$nd mode=xref-to
  xsl:with-param name=verbose select=0/
/xsl:apply-templates
  /xsl:otherwise
/xsl:choose
  xsl:text disable-output-escaping=yes]]gt;/xsl:text
/xreftext
xsl:apply-templates mode=olink.mode/
  /div
/xsl:template

xsl:template name=obj
  xsl:param name=nd select=./
  obj
xsl:call-template name=attrs
  xsl:with-param name=nd select=$nd/
/xsl:call-template
ttl
  xsl:text disable-output-escaping=yeslt;![CDATA[/xsl:text
xsl:apply-templates select=$nd mode=title.markup
  xsl:with-param name=verbose select=0/
/xsl:apply-templates
  xsl:text disable-output-escaping=yes]]gt;/xsl:text
/ttl
xreftext
  xsl:text disable-output-escaping=yeslt;![CDATA[/xsl:text
xsl:choose
  xsl:when test=$nd/@xreflabel
xsl:call-template name=xref.xreflabel
  xsl:with-param name=target select=$nd/
/xsl:call-template
  /xsl:when
  xsl:otherwise
xsl:apply-templates select=$nd mode=xref-to
  xsl:with-param name=verbose select=0/
/xsl:apply-templates
  /xsl:otherwise
/xsl:choose
  xsl:text disable-output-escaping=yes]]gt;/xsl:text
/xreftext
  /obj
/xsl:template

!-- overload olink.hottext template from common/olink.xsl --
!-- write xreftext trough value-of instead of copy-of --
xsl:template name=olink.hottext
  xsl:param name=target.database/
  xsl:param name=olink.lang select=''/
  xsl:param name=olink.key select=''/
  xsl:param name=referrer select=./
  xsl:param name=xrefstyle
xsl:choose
  xsl:when test=@role and not(@xrefstyle) 
  and $use.role.as.xrefstyle != 0
xsl:value-of select=@role/
  /xsl:when
  xsl:otherwise
xsl:value-of select=@xrefstyle/
  /xsl:otherwise
/xsl:choose
  /xsl:param

  xsl:choose
!-- If it has elements or text (not just PI or comment) --
xsl:when test=child::text() or child::*
  xsl:apply-templates/
/xsl:when
xsl:when test=$olink.key != ''
  !-- Get the xref text for this record --
  xsl:variable name=xref.text 
xsl:for-each select=$target.database 
  xsl:value-of disable-output-escaping=yes 
select=key('targetptr-key', $olink.key)/xreftext/node() /
/xsl:for-each
  /xsl:variable

  xsl:variable name=xref.number 
xsl:for-each select=$target.database 
  xsl:value-of select=key('targetptr-key', $olink.key)/@number /
/xsl:for-each
  /xsl:variable

  xsl:variable name=target.elem 
xsl:for-each select=$target.database 
  xsl:value-of select=key('targetptr-key', $olink.key)/@element /
/xsl:for-each
  /xsl:variable

  xsl:variable name=lang
xsl:variable name=candidate
  xsl:for-each select=$target.database 
xsl:value-of 
  select=key('targetptr-key', $olink.key)/@lang /
  /xsl:for-each
/xsl:variable
xsl:choose
  xsl:when test=$candidate != ''
xsl:value-of select=$candidate/
  /xsl:when
  xsl:otherwise
xsl:value-of select=$olink.lang/
  /xsl:otherwise
/xsl:choose
  /xsl:variable

  xsl:variable name=targetdoc
xsl:value-of select=substring-before($olink.key, '/')/
  /xsl:variable

  xsl:choose
xsl:when test=$xrefstyle != '' and