Re: Store non-well-formed HTML fragment

apologies, rereading and now grok your problem ...

this is quickly becoming an 'old chestnut' with XProc and the solution
is not ideal e.g. you can simply wrap your results in xslt, to make
sure you have a proper xml document then select children when you need
to compose them.

Dealing with non-xml (or near xml for that matter) is a 'front burner'
issue for XProc vnext ... we don't want to provide or condone black
magic approach and are now thinking things through to do it properly.

http://www.w3.org/wiki/XProc_Architecture

Please feel free to add to the discussion.

Jim Fuller

On Sun, Jun 2, 2013 at 1:40 PM, Vivian Steller <vivian@steller.info> wrote:
> Dear all,
> is there any way to serialize non-well-formed HTML using p:store?
> Particularly, I'm trying to store an HTML fragment that does not have a
> single root node. While this works with plain XSL result-documents, XProc
> fails with the following error:
>
> "XD0001 : XD0001 It is a dynamic error if a non-XML resource is produced on
> a step output or arrives on a step input."
>
> This is the full pipeline:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
> xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>     <p:input port="source">
>         <p:empty/>
>     </p:input>
>     <p:output port="result">
>         <p:pipe port="result" step="store"/>
>     </p:output>
>     <p:xslt name="xsl">
>         <p:input port="source">
>             <p:inline>
>                 <test/>
>             </p:inline>
>         </p:input>
>         <p:input port="parameters">
>             <p:empty/>
>         </p:input>
>         <p:input port="stylesheet">
>             <p:inline>
>                 <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
>                     <xsl:template match="/">
>                         <xsl:result-document href="test.snippet.xml"
> indent="yes" omit-xml-declaration="yes" method="xml"
> exclude-result-prefixes="#all">
>                             <div>
>                                 Test
>                             </div>
>                             <p>
>                                 Test
>                             </p>
>                         </xsl:result-document>
>                     </xsl:template>
>                 </xsl:stylesheet>
>             </p:inline>
>         </p:input>
>     </p:xslt>
>     <p:sink>
>         <p:input port="source">
>             <p:pipe port="result" step="xsl"/>
>         </p:input>
>     </p:sink>
>     <p:store name="store" href="test.html">
>         <p:input port="source">
>             <p:pipe port="secondary" step="xsl"/>
>         </p:input>
>     </p:store>
> </p:declare-step>
>
> Any help is appreciated.
> Cheers,
>
> Vivian
>

Received on Monday, 3 June 2013 12:18:49 UTC