[xsl] Re parsing element data generated by XSLT within the same stylesheet

Subject: [xsl] Re parsing element data generated by XSLT within the same stylesheet
From: "David A. Lee" <dlee@xxxxxxxxxxx>
Date: Tue, 29 Dec 2009 13:31:54 -0500
I'm trying to learn XSLT (better). I'm working with an existing complicated stylesheet that I need to make changes to.
I have a working solution where I output the XSLT piped to XQuery (which I know better) but I'd like to do the whole thing in XSLT.

The basic concept/solution I'm looking for is: is it possible, and how, to re-process generated elements that are not in the source document.

Simplified example: suppose I have a template like this. Suppose I have LOTS of templates like these.

<xsl:template match="v3:renderMultiMedia/v3:caption">
<xsl:call-template name="styleCodeAttr">
<xsl:with-param name="styleCode" select="@styleCode"/>
<xsl:with-param name="additionalStyleCode"
<xsl:apply-templates select="@*[not(local-name(.)='styleCode')]"/>
<xsl:apply-templates mode="mixed" select="node()"/>



What I'd like to do is change every <p>XXX</p> into XXX&#10;

Obviously I can edit every template to change how it generates the
output XML, but I'm wondering is there a way to do this in XSLT by saying
"Re-parse the generated XML by this template".

Right now, as I mentioned, I'm doing this by piping the output into
XQuery where its a trivial thing to change the <p>,
in fact a 2nd pass of XSLT could just as trivially do it. But can it be
done within one invocation ?

Any clues on where to look (I have Mr. Kay's excellent book) appreciated.

Thank you.

David A. Lee
dlee@xxxxxxxxxxx http://www.calldei.com

Current Thread