#8 Special indent handling for xsl:text


It would like to be able to specify that indenting of
xsl:text be handled differently.

<xsl:text> as the first text on a line is indented
Indentation of subsequent text lines up to and
including the line containing the </xsl:text> tag is
never changed.

</xsl:text> is ignored in calculating the indentation
of all subsequent tags.

This allows me to determine the indentation of the
contents of <xml:text/> tags without having that text
altered during entry or subsequent re-indention of the
file or part thereof.

Incidentally, the current indentation seems to be upset
by </xsl:text> end tags in many circumstances.


  • Glen Peterson

    Glen Peterson - 2003-08-24

    Logged In: YES

    I've been wondering about this issue for some time and you
    have just made up my mind. Indent-region (M-C-\) should
    not mess up <xsl:text>, <![CDATA[, or <!-- (comment)
    sections. It should work just as you say.

    I provided a patch to fix this for CDATA and comments in
    March, but my patch does not include xsl:text. Extending it
    is a simple matter. My patch was too big to merge all at
    once, so I have broken it into smaller pieces for Tony to
    merge. He has been merging my tabs vs. spaces changes for
    the past 11 days (but who's counting). When he is done, I
    will add xsl:text to my indentation patch and submit that next.

  • Glen Peterson

    Glen Peterson - 2003-09-05

    Logged In: YES

    I just posted a patch for this as part of my cumulative
    patch. You can find it at:


    Choose glensChanges2003-09-04.tar.gzip. Installation and
    other details are documented on the above page.

    Let me know if this addresses your issue.

  • Peter B. West

    Peter B. West - 2003-10-06

    Logged In: YES

    Sorry to take so long getting back to you glen, but I hvae
    just had the chance to look at this.

    Unless I am missing a critical variable setting, there is
    still a missing component to this. When I M-C-\ I on the
    file fragment below, I get this result:

    <xsl:stylesheet version="1.0"

    <xsl:output method="text" />

    <xsl:template match="allprops">
    <xsl:variable name="constlist">
    <xsl:sort select="@const"/>
    <xsl:value-of select="@const"/>:</xsl:for-each>
    package org.apache.fop.fo.properties;

    public interface Constants {</xsl:text>
    <xsl:call-template name="sortconsts">
    <xsl:with-param name="consts" select="$constlist"/>

    The </xsl:text> terminating tag still seems to be affecting
    the subsequent indentation. It seems to me that it should
    be "transparent" as far as indentation calculations are

  • Peter B. West

    Peter B. West - 2003-11-06

    Logged In: YES

    Note that in the example I gave in the previous posting, it
    seems to be only the </text> tag at the beginning of a line
    that is causing problems. These tags at the end of text on
    a line, or at least those which begin at a point past the
    cerrent indent column, do not affect subsequent indentation.
    I don't know if there are other cases which demonstrate
    incorrect behaviour.

  • Glen Peterson

    Glen Peterson - 2003-11-20

    Logged In: YES

    This is a bug in my new code. I just posted an explanation
    of my plans on the xslide mailing list (you might want to
    read it). I already fixed this bug in a future version, but
    I want to fix the version in CVS so that Tony can cut a
    release that fixes your problem sooner rather than wait for
    my new work to be completed.

    In the meantime, For Javascript, I do the following instead
    of using xsl:text which is why I didn't see this bug in my
    testing. Maybe you could do something similar as a
    workaround until I get this fixed? CDATA is nice because it
    preserves whitespace while ignoring illegal characters like
    the less-than in this example. The comment protects the
    Javascript from older browsers.

    <script type="text/javascript">
    if (a < b) { c; }
    // ]]></xsl:comment>

    Hope this helps. Sorry about the delay.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks