Re: [xslt] problem with special carater in CDATA (part 2)
- From: Philipp Dunkel <philipp dunkel org>
- To: xslt gnome org
- Subject: Re: [xslt] problem with special carater in CDATA (part 2)
- Date: 12 Feb 2003 19:15:52 +0100
Just a question:
Why don't you do either:
<xsl:value-of select="'<br/>'" disable-output-escaping="yes"/>
or just
<br/>
Could you just tell me?
TTY Philipp
On Wed, 2003-02-12 at 18:26, Arnaud Blancher wrote:
> I have a problem with special carater in CDATA
> for exemple
> <![CDATA[<]]><![CDATA[br />]]> in xslt
>
> become
> <br />
>
> or i want <br />
>
> in old version of redhat i haven't this problem
>
> Daniel tell :
>
> >
> > There was a bug in the old version apparently and it has been fixed
> > since it's a correct behaviour.
> > If you want XHTML1 special formating, make sure your xsl:output ask
> > for xml output and to add the XHTML1 DOCTYPE system and public ID. I
> > let you check section 16 of the XHTML1 spec and the XHTML1 spec for the
> > correct system and public IDs.
>
> so, i'have change my xslt, but the problem is still here
> if you can help me.
> thanks
>
> the same examples:
> - with xmlproc
> - in perl
>
> >
> >
> #---------------------------------------------------------------------------------------------
> xsltproc t.xsl t.xml
>
> #-----------------------------------------------
> # t.xsl
> #----------------------------------------------
>
> <?xml version="1.0"?>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>
> <xsl:output method="xml"
> doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
> />
>
> <xsl:template match="xml">
> <html>
> <xsl:call-template name="XeditHidden" />
> </html>
> </xsl:template>
>
> <xsl:template name="XeditHidden">
> <![CDATA[<]]><![CDATA[br />]]>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
>
> #----------------------------------
> # t.xml
> #----------------------------------
> <?xml version="1.0"?>
> <xml>
> <p chemin="/html_2" position="2"></p>
> </xml>
>
> #---------------------------------
> # return
> #---------------------------------
>
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html><br /></html>
>
> #---------------------------------------------------------------------------------------------
> # perl exemple
> #---------------------------------------------------------------------------------------------
> #!/usr/bin/perl
>
> # used version
> # redhat 8
> # libxml2-2.5.3-1.i386.rpm
> # zlib-devel-1.1.4-4.i386.rpm
> # libxml2-devel-2.5.3-1.i386.rpm
> # libxslt-1.0.26-1.i386.rpm
> # libxslt-devel-1.0.26-1.i386.rpm
> # perl 5.8
> # XML-LibXSLT-1.52
> # XML-LibXML-1.53
>
> # problem whith CDATA section
> # <![CDATA[<]]><![CDATA[br />]]> in xslt
> # become
> # <br />
> # in the output
>
>
> use XML::LibXSLT;
> use XML::LibXML;
>
> my $parser = XML::LibXML->new();
> my $xslt = XML::LibXSLT->new();
>
> my $xmlsource=<<EOF;
> <?xml version="1.0"?>
> <xml>
> <html chemin="/html_2" position="2"></html>
> </xml>
> EOF
> ;
>
> my $xslsource =<<EOF2;
> <?xml version="1.0"?>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0
> Strict//EN"
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
> />
>
> <xsl:template match="xml">
> <html>
> <xsl:call-template name="XeditHidden" />
> </html>
> </xsl:template>
>
> <xsl:template name="XeditHidden">
> <![CDATA[<]]><![CDATA[br />]]>
> </xsl:template>
>
> </xsl:stylesheet>
> EOF2
> ;
>
> #------------------------------------------------------------
> # transformation xml
>
> my $objXml = $parser->parse_string($xmlsource);
> my $style = $parser->parse_string($xslsource);
> my $stylesheet = $xslt->parse_stylesheet($style);
> my $results = $stylesheet->transform($objXml);
> my $xmlresult = $stylesheet->output_string($results);
>
> print $xmlresult;
> #------------------------------------------------------------
>
> 1;
>
> __END__
>
> result:
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html><br /></html>
>
>
>
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]