You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jeff Cutler-Stamm <jc...@thinkshare.com> on 2000/05/09 01:22:06 UTC
extension questions
hi all, new to the list so pls forgive me if this has been addressed
before...
i would like to write a Java Xalan extension which retrieves an xml document
from somewhere (say a URL or a database), creates a DOM from it, and then
applies the _current_ stylesheet to it in the current instance of the xalan
processor as if the DOM were grafted onto the source tree somewhere and then
<xsl:apply-templates /> were called on it. Can anyone suggest a good way to
achieve this? I tried actually modifying the source tree but got
DTMExceptions - looks like the tree is not editable.
thx.
-Jeff
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Jeff Cutler-Stamm Co-Founder |
| jcs@thinkshare.com ThinkShare/ |
| 503.756-4100 MetaTree |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: extension questions
Posted by Keith Visco <kv...@exoffice.com>.
You should put your Database code in a servlet if you can, which is
accessible via a URL call. This will allow you to continue to just use
the document() function and allow you to remain compatible with the XSLT
spec.
--Keith
Jeff Cutler-Stamm wrote:
>
> i'm not garaunteed to have a URL. my document is the result of some internal
> processing which might involve accessing another URL or a database of some
> kind but my extension is the thing that actually needs to create the DOM.
> one method I tried was:
>
> XSLTEngineImpl.setSourceDocument( "myFakeUrl", myDomTree );
>
> in my extension and then used document("myFakeUrl") in the stylesheet but
> that didn't seem to work (e.g. <xsl:apply-templates
> select="document('myFakeUrl')" /> returns nothing whereas if you give
> document() a file system path to an XML file it does work. The javadoc
> indicates that setSourceDocument() adds the Url->Document mapping to a table
> so that the next time it is requested, that Document object is used rather
> than the Url being evaluated again but this doesn't seem to be working.
>
> regards,
> jeff
>
> >
> > You could just use the document() function if you just have a URL.
> >
> > --Keith
> >
RE: extension questions
Posted by Jeff Cutler-Stamm <jc...@thinkshare.com>.
i'm not garaunteed to have a URL. my document is the result of some internal
processing which might involve accessing another URL or a database of some
kind but my extension is the thing that actually needs to create the DOM.
one method I tried was:
XSLTEngineImpl.setSourceDocument( "myFakeUrl", myDomTree );
in my extension and then used document("myFakeUrl") in the stylesheet but
that didn't seem to work (e.g. <xsl:apply-templates
select="document('myFakeUrl')" /> returns nothing whereas if you give
document() a file system path to an XML file it does work. The javadoc
indicates that setSourceDocument() adds the Url->Document mapping to a table
so that the next time it is requested, that Document object is used rather
than the Url being evaluated again but this doesn't seem to be working.
regards,
jeff
>
> You could just use the document() function if you just have a URL.
>
> --Keith
>
Re: extension questions
Posted by Keith Visco <kv...@exoffice.com>.
You could just use the document() function if you just have a URL.
--Keith
Jeff Cutler-Stamm wrote:
>
> hi all, new to the list so pls forgive me if this has been addressed
> before...
>
> i would like to write a Java Xalan extension which retrieves an xml document
> from somewhere (say a URL or a database), creates a DOM from it, and then
> applies the _current_ stylesheet to it in the current instance of the xalan
> processor as if the DOM were grafted onto the source tree somewhere and then
> <xsl:apply-templates /> were called on it. Can anyone suggest a good way to
> achieve this? I tried actually modifying the source tree but got
> DTMExceptions - looks like the tree is not editable.
>
> thx.
> -Jeff
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | Jeff Cutler-Stamm Co-Founder |
> | jcs@thinkshare.com ThinkShare/ |
> | 503.756-4100 MetaTree |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~