xsl-list
[Top] [All Lists]

Re: Adding structure to text nodes

2003-03-19 13:03:15
The wanted re-formatting of the text is achieved easily using the
"str-split-to-words" template from FXSL:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:vendor="urn:schemas-microsoft-com:xslt"


   <xsl:import href="strSplit-to-Words.xsl"/>

   <!-- to be applied on words.xml -->

   <xsl:output indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/">
      <xsl:variable name="vWords">
        <xsl:call-template name="str-split-to-words">
          <xsl:with-param name="pStr" select="/*"/>
          <xsl:with-param name="pDelimiters" select="', &#9;&#10;&#13;'"/>
        </xsl:call-template>
      </xsl:variable>

      <xsl:for-each select="vendor:node-set($vWords)/*">
        <xsl:value-of select="concat(., '&#xA;')"/>
      </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>

When applied on the provided source.xml:

<long>blabla
blabla
blabla
</long>


The desired result is produced:

blabla
blabla
blabla


It seems to me, though, that the problem is not formulated very well -- e.g.
what is exactly the "structure" that the result must have?


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"Cams Ismael" <Ismael(_dot_)Cams(_at_)siemens(_dot_)com> wrote in message
news:57FD2C3A246F76438CA6FDAD8FE9F1957ABC54(_at_)hrtades7(_dot_)atea(_dot_)be(_dot_)(_dot_)(_dot_)
And the formate with in that long tag will not be altered.

The problem is that it's my wish that the format is altered. If I have

<long>blabla
blabla
blabla
</long>

the output should not be:

blabla
blabla
      blabla

but instead:

blabla
blabla
blabla

So the content must be altered, but in a structured way. So it's actually
like reading the thoughts of the author of the xml file. I know I never can
accomplish this for 100%. But some hints and tricks can lead me maybe to an
acceptable solution.

Ismaël

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list