Re: [xep-support] Problems with fo tags written via disabled output-escaping

From: Nikolai Grigoriev (
Date: Fri May 23 2003 - 12:53:23 PDT

  • Next message: dougb: "Re: [xep-support] Problems with fo tags written via disabled output-escaping"


    > Due to the input structure of my XML file, I need to write an fo:block
    > start-tag in one template, and write the end-tag in another. I've done
    > this via <xsl:text
    > disable-output-escaping="yes">&lt;fo:block&gt;</xsl:text>
    > etc. etc. I ended up with the layout I wanted in the output PDF, but the
    > fo:block start and end tags were passed through as escaped text as well.

    Disabling output escaping only works if the XSLT processor is responsible
    for serialization of the resulting XML tree. Here's the relevant quote
    from XSLT 1.0 Rec [16.4 Disabling Output Escaping]:

    XSLT> An XSLT processor will only be able to disable output
    XSLT> escaping if it controls how the result tree is output.
    XSLT> This may not always be the case. For example, the
    XSLT> result tree may be used as the source tree for another
    XSLT> XSLT transformation instead of being output.

    In the case of XEP, the result of XSLT transformation arrives
    to the formatter through SAX interface; and a text node remains
    a text node, whatever be its output escaping status.

    > I then wrote the FO file separately with Saxon 6.4.1, validated it
    > successfully with XEP, and wrote the output PDF. This resulted
    > in the layout I wanted, without the escaped <fo:block> tags.

    Yes, because the resulting text was put once again through an XML
    parser, and the escaped blocks were reinterpreted as markup,
    rather than text nodes. This is the only option: if you insist on using
    disable-output-escaping, you have to go through this double
    serialization/parsing cycle (and accept the performance penalty).

    However, disable-output-escaping is a scapegoat of XSLT,
    much like the goto operator in procedural languages :-) -
    its use is potentially dangerous and therefore deprecated.
    In most cases, there exist equivalent ways of achieving
    the same markup with normal, regularly nested structures.
    What are you using in for?

    Nikolai Grigoriev

    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service

    This archive was generated by hypermail 2.1.5 : Fri May 23 2003 - 12:59:00 PDT