On 18/02/2013 08:58, bryan rasmussen wrote:
as in your example
<title>hello</title> unescape it
Well of course the actual string content of the node is then
<title>hello</title>
The entities are not there so the "unescape" operation is the function
of an xml parser, to turn a string containing xml markup into a node tree.
XPath 3 will have an xml parser as standard, many xpath 1 or 2 systems
have an xml parser as extension functions.
A pure xslt way of course is to write the file out in one transfom and
then read it back in another.
Or for relatively simple xml-like markup there is a parser written in
XSLT available at
http://web-xslt.googlecode.com/svn/trunk/htmlparse/htmlparse.xsl
which you could use as
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="data:,dpc">
<xsl:import
href="http://web-xslt.googlecode.com/svn/trunk/htmlparse/htmlparse.xsl"/>
<xsl:output omit-xml-declaration="yes"/>
<xsl:variable name="data">
<doc>
<title>hello</title>
</doc>
</xsl:variable>
<xsl:template name="main">
<xsl:variable name="pdata" select="d:htmlparse($data,'',false())"/>
<xsl:value-of select="$pdata/doc/title"/>
</xsl:template>
</xsl:stylesheet>
which produces:
$ saxon9 -it main xp.xsl
hello
David
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--