xsl-list
[Top] [All Lists]

Re[3]: [xsl] applying code from inside the comment

2007-01-16 14:19:52
Tuesday, January 16, 2007, 8:53:10 PM, you wrote:
WP> That's a pretty nice example of micropipelining.
Thank you.

WP> It could be tightened up a bit:
WP> At 12:12 PM 1/16/2007, you wrote:
<xsl:template match="//comment()[contains(.,'drive_panel')]">
    <xsl:variable name="comment">
        &lt;comment&gt;
                <xsl:value-of select="."/>
        &lt;/comment&gt;
    </xsl:variable>

    <xsl:variable name="node-set" select="saxon:parse($comment)" />
    <xsl:apply-templates select="$node-set"/>
</xsl:template>

<xsl:template match="comment">
        <xsl:apply-templates select="node() except ./text()"/>
</xsl:template>

WP> <xsl:template match="comment()[contains(.,'drive_panel')]">
WP>      <xsl:variable name="comment" select="saxon:parse(.)"/>
WP>      <xsl:apply-templates select="$comment except $comment/text()"/>
WP> </xsl:template>

WP> Note: untested. You might have to try "saxon:parse(string())".

Of course it can, but I apply this template against comments of which
xml validity I'm not so sure. Therefore if I do something like

<xsl:variable name="comment" select="saxon:parse(.)"/>

and my comment will contain
<!--
<a>
   some node set
</a>
<b>
   some other nodeset
</b>
..
-->

I'll receive document has no root element error. That's why
this pipelined workaround is applied.

-- 
Alexey                            
mailto:alexey(_dot_)nikolaenkov(_at_)actimind(_dot_)com


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

<Prev in Thread] Current Thread [Next in Thread>