This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Mozilla XML > October 2005 > getting plain text from the xslt processor...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author getting plain text from the xslt processor...
Rui Paiva

2005-10-06, 6:42 pm

Hi everyone,

I am trying to get a plain text string as a result of a xsltransform, but I
am getting instead
<transformiix:result xmlns:transformiix="http://......">My/text/message
</transformiix:result>

using the following xslTransform...

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">

<xsl:output method="text" version="1.0" encoding="ISO-8859-1" />

<xsl:template match="/" >

<xsl:value-of select=" concat ( //FileList [ @currentFileList =
'true' ]/RelativePath/text(), '/' ) " />
<xsl:value-of select=" //FileList [ @currentFileList =
'true' ]/FileName/text() " />

</xsl:template >

</xsl:stylesheet>

How do I get rid of the <transformiix:result> element and keep only element
text ?

Thanks

Rui


Emmanouil Batsis

2005-10-07, 6:35 pm


I havent seen your code but i believe the result of it must be a
Document object. You can only have that if the transformation result
serialization is a well-formed XML document. The wrapper is there for
just that.

Manos

Rui Paiva wrote:
> Hi everyone,
>
> I am trying to get a plain text string as a result of a xsltransform, but I
> am getting instead
> <transformiix:result xmlns:transformiix="http://......">My/text/message
> </transformiix:result>
>
> using the following xslTransform...
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="2.0">
>
> <xsl:output method="text" version="1.0" encoding="ISO-8859-1" />
>
> <xsl:template match="/" >
>
> <xsl:value-of select=" concat ( //FileList [ @currentFileList =
> 'true' ]/RelativePath/text(), '/' ) " />
> <xsl:value-of select=" //FileList [ @currentFileList =
> 'true' ]/FileName/text() " />
>
> </xsl:template >
>
> </xsl:stylesheet>
>
> How do I get rid of the <transformiix:result> element and keep only element
> text ?
>
> Thanks
>
> Rui
>
>

Martin Honnen

2005-10-07, 6:35 pm



Rui Paiva wrote:


> I am trying to get a plain text string as a result of a xsltransform, but I
> am getting instead
> <transformiix:result xmlns:transformiix="http://......">My/text/message
> </transformiix:result>


That is as documented here:
<http://www.mozilla.org/projects/xslt/js-interface.html>
Simply read out
resultDocument.documentElement.textContent
then to have the text result.



--

Martin Honnen
http://JavaScript.FAQTs.com/
Rui Paiva

2005-10-08, 6:26 pm

Thanks guys...

I thought the (output method="text") returned a dumb string variable (and in
fact it does, in IE), but since i am trying to write a cross browser app, i
changed the method to xml, and then I get the textContent of the
documentElement.

Have a good one...

Rui

"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:di5p55$hd01@ripley.aoltw.net...
>
>
> Rui Paiva wrote:
>
>
>
> That is as documented here:
> <http://www.mozilla.org/projects/xslt/js-interface.html>
> Simply read out
> resultDocument.documentElement.textContent
> then to have the text result.
>
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/



Rui Paiva

2005-10-08, 6:26 pm

Thanks guys...

I thought the (output method="text") returned a dumb string variable (and in
fact it does, in IE), but since i am trying to write a cross browser app, i
changed the method to xml, and then I get the textContent of the
documentElement.

Have a good one...

Rui

"Emmanouil Batsis" <no@spam.foobar> wrote in message
news:di5m18$6nr1@ripley.aoltw.net...[color=darkred]
>
> I havent seen your code but i believe the result of it must be a Document
> object. You can only have that if the transformation result serialization
> is a well-formed XML document. The wrapper is there for just that.
>
> Manos
>
> Rui Paiva wrote:


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews