Re: [xslt] crappy formatting with <xsl:text>



On 27/07/11 11:28, Jan Kotuc wrote:
Hello, this is the desired test case (attached).

RESULT:

One can clearly see that one file is pretty-printed and the other one
is not, even though both are well-formed and machine-readable. Why is
that so???

That's the way the indenting works in libxml2. As soon as an element containing a text node is found, indenting is disabled for all the contents of that element. So if you had something like the following, everything should work as expected:

<another-element>
    <xsl:text disable-output-escaping="yes">&#38;some-link-name;</xsl:text>
</another-element>

Such approach outputs the entity name correctly, at the cost of
"prettiness". Is there a better way? I'd like to have an output file
which is (A) well-formed, (B) contains a correct and not corrupt
DocBook link such as shown before, (C) pretty-printed. Can I achieve
that with libxslt? Right now I'm afraid I'll have to introduce the
problematic link by sed :(

If the entity reference must be created inside the chapter element, then I don't think there's a way to achieve indenting.

Nick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]