You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by James Grimes <ja...@itsmobile.com> on 2000/10/10 20:27:28 UTC

Converting XML to plain text using XSL?

Forgive me if I'm asking a daft question here, but I have some style sheets
which I have hve converted to HTML and WML for WEB and WAP presentation. I
also want to convert it to plain text for mailing purposes. I have created a
new stylesheet :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

  <xsl:template match="/">
      <xsl:apply-templates select="BookingConfirmation/BookingDetails"/>
  </xsl:template>

  <!-- Booking details -->

  <xsl:template match="BookingDetails">
  ......
  </xsl:template>
</xsl:stylesheet>

I am running the transformation on the server side and in my output I get my
text but it is always prefixed with :

<?xml version="1.0" encoding="UTF-8"?>
....(text).....

Obviously I don't want this text. Hoe do I instruct the stylesheet not to
output it during transformation?

thanks in advance.


Re: Converting XML to plain text using XSL?

Posted by David Delgranche <co...@rd.francetelecom.fr>.
James Grimes wrote:

> Forgive me if I'm asking a daft question here, but I have some style sheets
> which I have hve converted to HTML and WML for WEB and WAP presentation. I
> also want to convert it to plain text for mailing purposes. I have created a
> new stylesheet :
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
>   <xsl:template match="/">
>       <xsl:apply-templates select="BookingConfirmation/BookingDetails"/>
>   </xsl:template>
>
>   <!-- Booking details -->
>
>   <xsl:template match="BookingDetails">
>   ......
>   </xsl:template>
> </xsl:stylesheet>
>
> I am running the transformation on the server side and in my output I get my
> text but it is always prefixed with :
>
> <?xml version="1.0" encoding="UTF-8"?>
> ....(text).....
>
> Obviously I don't want this text. Hoe do I instruct the stylesheet not to
> output it during transformation?
>
> thanks in advance.

Just add <xsl:output method="text"/> at the beginniong of your stylesheet and
that will be ok.