[xslt] <![CDATA[&]]>



Hi,
I have a problem with "&" in URL encoded text-fragments.
I need a & not encoded as &amp; to separate hash-value pairs in urls.
I dont know whether it is a bug or a feature, but in older versions of the libxml/libxsl it was possible to do this with <![CDATA[&]]>, but on the current versions this does not work anymore:

OLD VERSION:

  [root@grinDB /root]# xsltproc --version
  Using libxml 20420, libxslt 10016 and libexslt 707
  xsltproc was compiled against libxml 20420, libxslt 10016 and libexslt 707
  libxslt 10016 was compiled against libxml 20420
  libexslt 707 was compiled against libxml 20420
  [root@grinDB /root]# cat foo.xml
  <?xml version="1.0"?><foo/>
  [root@grinDB /root]# cat foo.xsl
  <?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="/">
      <![CDATA[&]]>
    </xsl:template>
  </xsl:stylesheet>
  [root@grinDB /root]# xsltproc foo.xsl foo.xml
  <?xml version="1.0"?>
  &
  [root@grinDB /root]# 

NEW VERSION:

  [root@chat ~]# xsltproc --version
  Using libxml 20428, libxslt 10023 and libexslt 714
  xsltproc was compiled against libxml 20428, libxslt 10023 and libexslt 714
  libxslt 10023 was compiled against libxml 20428
  libexslt 714 was compiled against libxml 20428
  [root@chat ~]# cat foo.xml
  <?xml version="1.0"?><foo/>
  [root@chat ~]# cat foo.xsl
  <?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="/">
      <![CDATA[&]]>
    </xsl:template>
  </xsl:stylesheet>
  [root@chat ~]# xsltproc foo.xsl foo.xml 
  <?xml version="1.0"?>
  &amp;
  [root@chat ~]#

Im quite unsure, what to do. Is there annother possibility to create just a plain "&" ?

/Best Regards
Julius Mittenzwei



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]