This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Re: apply-templates abnormality???
- From: "Nesbitt, David" <DNesbitt at gensys dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 13 May 2002 11:25:02 -0700
- Subject: RE: [xsl] Re: apply-templates abnormality???
- Reply-to: xsl-list at lists dot mulberrytech dot com
Dimitre,
Thank you so much for the helpful and explanatory response. It not only
works now, but I understand why it didn't work before. :-) I really
appreciate your time and assistance!!!
Best Regards,
Dave
> -----Original Message-----
> From: Dimitre Novatchev [mailto:dnovatchev@yahoo.com]
> Sent: Friday, May 10, 2002 10:28 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Re: apply-templates abnormality???
>
>
> > I am trying to create data in my stylesheet and apply a template as
> > if
> > the data came from the source document.
> >
> > For example:
> >
> > <xsl:variable name="add-apply-button">
> > <xsl:element name="button">
> > <xsl:element name="file">APPLY_BUTTON</xsl:element>
> > <xsl:element name="result">APPLY</xsl:element>
> > </xsl:element>
> > </xsl:variable>
> > <xsl:apply-templates select="$add-apply-button">
> > <xsl:with-param
> > name="submit-form">AddEditView</xsl:with-param>
> > </xsl:apply-templates>
> >
> > I want this to simulate the following xml data:
> >
> > <button>
> > <file>APPLY_BUTTON</file>
> > <result>APPLY</result>
> > </button>
> >
> > It works except for one major problem. The param "submit-form" does
> > not
> > seem to get set when the "button" template is applied. The "button"
> > template is getting invoked and it is acting as if the data
> came from
> > the source document. The problem is the param. It is an empty
> > string
> > even though I am using with-param and giving it a value.
> >
> > I am using Saxon 6.3. Does this seem like a problem with my XSLT
> > code
> > or with Saxon?
>
>
> It is with your code, and obviously Saxon 6.3 implements XSLT 1.1,
> otherwise you'd have an error reported on your attempt to use the RTF
> (Result Tree Fragment) as a node-set.
>
> The problem is that an RTF, when converted to a node-set is a separate
> xml document, so the following code:
>
> > <xsl:apply-templates select="$add-apply-button">
> > <xsl:with-param
> > name="submit-form">AddEditView</xsl:with-param>
> > </xsl:apply-templates>
> >
>
> will apply a template to the root (/) of the document, to which
> $add-apply-button evaluates.
>
> Probably your template (if any) matching / does not care for any
> parameters, nor it passes them down to any templates applied
> on /node()
>
> The solution is to replace the above with:
>
> <xsl:apply-templates select="$add-apply-button/*">
> <xsl:with-param
> name="submit-form">AddEditView</xsl:with-param>
> </xsl:apply-templates>
>
> in case you're using an XSLT 1.0 complient XSLT processor, you'll have
> to use vendor:node-set($add-apply-button)/*
>
> Cheers,
> Dimitre Novatchev.
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list