You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Anders Janmyr <an...@netpuls.nu> on 2001/02/20 09:37:21 UTC

text() selction problem.

Hello,

I don't know if this is a bug so I'll just describe my problem.
I'm Using Windows NT and Xalan-J-2.0.0.


Im trying to convert a page that looks like this:

<page>
    Text for element 1.
    <e1>Element 1</e1>
    Text for element 2.
    <e2>Element 2</e2>
</page>

with this stylesheet rule:

<xsl:template match="e2">
    <test headline="preceding-sibling::text()"/>
</xsl:template>

The result is:
<test headline="&#10;    Text for element 1.&#10;    "/>

What I would expect is the the second text, something like this:
<test headline="Text for element 2."/>

I have also had problems when using text()[n] addressing in the stylesheets.

Are there problem with the text() node?

Any help is appreciated.

Anders




Re: Outputting newlines

Posted by James Melton <ja...@cylogix.com>.
The whitespace is also considered text data. If you include whitespace
inside your <xsl:text> it will be part of the output.

Jim.

Vanessa D Johnson wrote:
> 
> I am trying to output carriage return, line feed and tab formatting to a
> text document, from the transformation of a XML file  via XSL.
> 
> <xsl:text>yyyyy</xsl:text>
> <xsl:value-of select="some_value"/>
> 

____________________________________________________________
James Melton                 CyLogix
609.750.5190                 609.750.5100
james.melton@cylogix.com     www.cylogix.com

Outputting newlines

Posted by Vanessa D Johnson <va...@jpl.nasa.gov>.
I am trying to output carriage return, line feed and tab formatting to a 
text document, from the transformation of a XML file  via XSL.  The XSL 
uses the output format as text.  I haven't found an answer to how to do 
that from the w3C XSLT primer.  Do you have any suggestions?

I want to output

  yyyyy
  xxxxx


and have

<xsl:text>yyyyy</xsl:text>
<xsl:value-of select="some_value"/>


(where some_value  ends up being xxxxx)


Vanessa

Vanessa D. Johnson
Advanced Mission Software Technology Group
Mission Execution and Automation - Section 368
Jet Propulsion Laboratory
voice: (818) 354-3885