W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2011

RE: Adding a stylesheet PI

From: <vojtech.toman@emc.com>
Date: Tue, 15 Mar 2011 06:20:34 -0400
To: <xproc-dev@w3.org>
Message-ID: <3799D0FD120AD940B731A37E36DAF3FE334C19C033@MX20A.corp.emc.com>
> Suppose you have a nice pipeline which constructs some nice XML
> document, and you want to add a (static) stylesheet PI to it.
> 
> I have not found any clean way to do this -- I've ended up doing this:
> 
>  <p:insert match="/foo" position="last-child">
>   <p:input port="insertion">
>    <p:pipe step="[previous]" port="result"/>
>   </p:input>
>   <p:input port="source">
>    <p:inline>
>     <foo><?xml-stylesheet type="text/xsl" href="oToHtml.xsl"?></foo>
>    </p:inline>
>   </p:input>
>  </p:insert>
> 
>  <p:unwrap match="/foo"/>
> 
> Can anyone improve on that?

I think this is about as far as you can get with the 'plain XProc' approach. You can also imagine inserting a "<?xml-stylesheet?>foo" document into the original document and the using p:delete to remove the "foo" element, but that is just a variation on the same theme. The problem is that the content of p:inline must be a well-formed XML document, so you cannot specify a processing instruction without some kind of a dummy document element next.

What about using p:xslt (p:xquery?) to add the PI?

Vojtech



--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech
Received on Tuesday, 15 March 2011 10:21:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 15 March 2011 10:21:48 GMT