Project

Profile

Help

setParameter

Added by Anonymous over 19 years ago

Legacy ID: #3229156 Legacy Poster: jake32 (jake32)

Hello, I switched from Xalan to Saxon recently because some initial testing between the 2 for what I am doing showed that Saxon was faster and can use less memory. I have 1 problem so far. When using Xalan, I was setting a parameter which was a org.w3c.dom.Document. ... transformer.setParameter("applicationXML",(Document) doc) ... to set this param in the xsl stlesheet. <xsl:param name="applicationXML"/> Then I was accessing the param like this from within the stylesheet: ... <xsl:template name="getTSQLBatchBySyncXML"> <xsl:variable name="rType" select="substring-after(name(.), 'r')"/> <xsl:variable name="rName" select="$applicationXML/d/rt[@key=$rType]/@nam"/> ... BUT when I use the "net.sf.saxon.TransformerFactoryImpl" factory inplementation, it seems to set the param as doc.toString() Is there anyway to set a param with a document? Am I missing something? Any help would be appreciated. Thanks, Jake


Replies (3)

Please register to reply

RE: setParameter - Added by Anonymous over 19 years ago

Legacy ID: #3229229 Legacy Poster: jake32 (jake32)

Also, if there is a better way to do what I am trying to do, I would love to know that too. The issue is that I have 2 xml sources. The one that I am trying to pass as a parameter into the stylesheet is basically static, but only lives in memory which is initialized when the webapp starts up. The second xml source comes from a database and is dynamic. thanks again, jake

RE: setParameter - Added by Anonymous over 19 years ago

Legacy ID: #3229545 Legacy Poster: Michael Kay (mhkay)

If you're using Saxon 8.4, then DOM classes such as Document are recognized only if saxon8-dom.jar is on the classpath. Don't create a DOM specially for Saxon - Saxon's own tree implementation is much more efficient. You can supply any Source object as the value of the parameter (for example, a StreamSource) and Saxon will then build the tree itself (if it needs to). Michael Kay

RE: setParameter - Added by Anonymous over 19 years ago

Legacy ID: #3230099 Legacy Poster: jake32 (jake32)

Thanks for taking time to respond yourself. I'm all straightened out for now. It was sort of a thrill for me to get your email. I keep your XSLT Programmers Reference on my desk at all times. Its one of the most consistently useful books I have. -jake

    (1-3/3)

    Please register to reply