[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re[3]: applying code from inside the comment
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"> >> <comment> >> <xsl:value-of select="."/> >> </comment> >> </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.nikolaenkov@xxxxxxxxxxxx
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|