xsl-list
[Top] [All Lists]

Re: [xsl] Turning escaped mixed content back to XML

2014-03-28 13:32:35
On Fri, Mar 28, 2014 at 11:12:37AM -0700, Martin Holmes scripsit:
[getting escaped text back into parsed content]
    <xsl:template match="text:p" exclude-result-prefixes="#all">
        <xsl:variable name="unparsed">
            <xsl:copy-of select="*|text()"/>
        </xsl:variable>

$unparsed is going to be item()* instead of string if it's formed like
that, and I don't think saxon:parse will work on item()* as input, it
wants a single string.

If text:p's contents are purely escaped markup text, normalize-space(.)
ought to work; if it's mixed content, you probably have to do the
string-join dance with saxon:serialize to get a single string to feed
saxon:parse, or figure out some way to return only the escaped text if
that's all you're interested in.

Might actually be a use case for //text()[normalize-space()]  :)

-- Graydon

--~------------------------------------------------------------------
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>
--~--