Subject: Re: [xsl] Capturing result of <xsl:apply-templates/> in a variable From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 06 Dec 2011 20:25:41 +0000 |
the + there means this will generate an error if the apply-templates generates no output, whereas the original version would just silently produce nothing. a * would allow this empty result.Just now when writing a transform, for temporary diagnostic purposes I needed to produce messages showing (1) the initial string value of an input element before template application, and (2) the output string value after template application. Oddly enough I have never before wanted to do precisely that task.
A moment's reflection suggested that I could capture the result of <xsl:apply-templates/> and use it as a variable, thus (given XSLT 2.0):
<xsl:template match="INPUT"> <xsl:variable name="appliedTemplates" as="item()+"> <xsl:apply-templates/> </xsl:variable>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Capturing result of <xsl:, Wendell Piez | Thread | Re: [xsl] Capturing result of <xsl:, David Sewell |
Re: [xsl] sanely ordering template , James A. Robinson | Date | Re: [xsl] Capturing result of <xsl:, David Sewell |
Month |