Title: RE: Extension: how to return java values from templates?

Hello Brad,

I really believe that your problem has less to do with extensions but with XPath ans XSLT in general:

you wrote:
> Don't the following statements "call" template2 and store the value
> returned by template2 in local variables?
>
> >  >       <xsl:variable name="content" select="ile:content"/>
> >>        <xsl:variable name="template" select="ile:template"/>
>

Exactly, these statements don't call any template.
I think your confusion can be changed to understanding very easily: the magic word ix XPath!

Nearly all statements in nearly all "select" clauses have nothing to do with XSLT! These
select statements are always XPath expressions. Do you know the XPath specification?
However, the XPath expressions are working on the source document and are independent from the XSLT calling them. An XPath _expression_ evaluates the statement and usually returns a NodeSet - that's exactly the behaviour in your case (the error message told you that you've passed to nodesets). So, the following diagram should clearify the situation (I tried to draw an UML swimlane diagram in test):

        XSLT                XPath
      Processor           Processor
          |                   |
    apply-template            |
          #                   |
          # select"..."       |
          #------------------># 
          |                   # parse select statement and
          |                   # evaulate _expression_
          | return nodeset    #
          #<------------------#
          #                   |
          #                   |

The XPath doesn't call the XSLT processor again - the nodeset is directly calculated from the source XML document. That's why - in your case - the second template is not called.

Does this help you?

Regards,

Jens

Reply via email to