You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/07/19 18:45:31 UTC
Xalan Interceptor?
Is there a way to write some sort of plug-in extension to Xalan that
intercepts the resultant output of an <xsl:template> match for manipulation
purposes prior to writing it to the stream? For example, let's say I have
the following XSL snippet:
...
<xsl:template match="Name">
<b>Name: <xsl:value-of select="."/></b>
</xsl:template>
...
I'd like to intercept the output of "<b>Name: Joe Blow</b>" and manipulate
it by embedding <em> tags around it. (This is a very simplified
example...suffice it to say that the decision of which matched elements to
manipulate depends on some back-end Java code.) I'll never know which
elements I need to manipulate until I've seen the XML.
Is this possible?
Thanks for your help!
- Sean T.
Re: Xalan Interceptor?
Posted by Gary L Peskin <ga...@firstech.com>.
Sean --
I would think that you could surround your template contents with an
xsl:variable element to assign the contents of the template to a
variable. Then, you could pass that variable into an extension function
to manipulate it in java and return the result you wanted to see.
Something like:
<xsl:template match="Name">
<xsl:variable name="templResult">
<b>Name: <xsl:value-of select="."/></b>
</xsl:variable>
<xsl:copy-of select="myExt:myFunc($templResult)">
</xsl:template>
Haven't tested this but will this accomplish what you need?
Gary
"Timm, Sean" wrote:
>
> Is there a way to write some sort of plug-in extension to Xalan that
> intercepts the resultant output of an <xsl:template> match for manipulation
> purposes prior to writing it to the stream? For example, let's say I have
> the following XSL snippet:
>
> ...
> <xsl:template match="Name">
> <b>Name: <xsl:value-of select="."/></b>
> </xsl:template>
> ...
>
> I'd like to intercept the output of "<b>Name: Joe Blow</b>" and manipulate
> it by embedding <em> tags around it. (This is a very simplified
> example...suffice it to say that the decision of which matched elements to
> manipulate depends on some back-end Java code.) I'll never know which
> elements I need to manipulate until I've seen the XML.
>
> Is this possible?
>
> Thanks for your help!
>
> - Sean T.
RE: Xalan Interceptor?
Posted by Ed Staub <es...@mediaone.net>.
Sean,
Are you doing this under Cocoon?
This strikes me as the kind of pipeline processing that it's made for.
-Ed Staub
-----Original Message-----
From: Timm, Sean [mailto:STimm@mailgo.com]
Sent: Wednesday, July 19, 2000 12:46 PM
To: 'xalan-dev@xml.apache.org'
Subject: Xalan Interceptor?
Is there a way to write some sort of plug-in extension to Xalan that
intercepts the resultant output of an <xsl:template> match for manipulation
purposes prior to writing it to the stream? For example, let's say I have
the following XSL snippet:
...
<xsl:template match="Name">
<b>Name: <xsl:value-of select="."/></b>
</xsl:template>
...
I'd like to intercept the output of "<b>Name: Joe Blow</b>" and manipulate
it by embedding <em> tags around it. (This is a very simplified
example...suffice it to say that the decision of which matched elements to
manipulate depends on some back-end Java code.) I'll never know which
elements I need to manipulate until I've seen the XML.
Is this possible?
Thanks for your help!
- Sean T.