#8 Special indent handling for xsl:text

open
nobody
5
2003-06-25
2003-06-25
No

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
normally.
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.

Discussion

  • Glen Peterson

    Glen Peterson - 2003-08-24

    Logged In: YES
    user_id=750563

    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
    user_id=750563

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

    http://sourceforge.net/tracker/index.php?
    func=detail&aid=742946&group_id=22964&atid=377145

    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
    user_id=472162

    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"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="text" />

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

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

    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
    concerned.

     
  • Peter B. West

    Peter B. West - 2003-11-06

    Logged In: YES
    user_id=472162

    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
    user_id=750563

    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">
    <xsl:comment><![CDATA[
    javascriptFun()
    {
    if (a < b) { c; }
    }
    // ]]></xsl:comment>
    </script>

    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