You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Joerg Baumann <Jo...@stud.informatik.uni-erlangen.de> on 2002/05/03 04:12:05 UTC
extension elements
Hi,
I would like to generate new markup for the result tree from my own
extensions element.
All samples I found return either a string or null.
I guess, I should create a class implementing org.w3c.dom.Element,
but I can't find a suitable Factory via
org.apache.xalan.extensions.XSLProcessorContext.
A simple Example:
XML-file:
<doc/>
XSL-rule:
<xsl:template match="/doc>
<myext:genMarkup att="value"/>
</xsl:template>
Desired output:
<a>value</a>
Extension element:
<lxslt:script lang="javascript">
function genMarkup(xslproc, elem) {
val = elem.getAttribute ("att");
// This does not work.
// Somthing like:
// e = ?.createElement("a");
// e.setText(val);
// return e;
// would be nice ;-)
return "<a>" + val + "</a>";
}
</lxslt:script>
Regards,
joerg
"Sometimes when I'm talking, my words can't keep up with
my thoughts. I wonder why we think faster than we can speak."
-- "Probably so we can think twice."
(Calvin & Hobbes)
RE: extension elements
Posted by Gary L Peskin <ga...@firstech.com>.
You'll need to create a Node or NodeIterator from your favorite DOM
implementation.
Gary
> -----Original Message-----
> From: Joerg Baumann
> [mailto:Joerg.Baumann@stud.informatik.uni-erlangen.de]
> Sent: Thursday, May 02, 2002 7:12 PM
> To: xalan-j-users@xml.apache.org
> Subject: extension elements
>
>
> Hi,
>
> I would like to generate new markup for the result tree from
> my own extensions element. All samples I found return either
> a string or null. I guess, I should create a class
> implementing org.w3c.dom.Element, but I can't find a suitable
> Factory via org.apache.xalan.extensions.XSLProcessorContext.
>
> A simple Example:
>
> XML-file:
>
> <doc/>
>
> XSL-rule:
>
> <xsl:template match="/doc>
> <myext:genMarkup att="value"/>
> </xsl:template>
>
> Desired output:
>
> <a>value</a>
>
> Extension element:
>
> <lxslt:script lang="javascript">
> function genMarkup(xslproc, elem) {
> val = elem.getAttribute ("att");
> // This does not work.
> // Somthing like:
> // e = ?.createElement("a");
> // e.setText(val);
> // return e;
> // would be nice ;-)
> return "<a>" + val + "</a>";
> }
> </lxslt:script>
>
> Regards,
> joerg
>
> "Sometimes when I'm talking, my words can't keep up with
> my thoughts. I wonder why we think faster than we can speak."
> -- "Probably so we can think twice."
> (Calvin & Hobbes)
>
>
>