You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Norman Walsh <nd...@nwalsh.com> on 2001/05/13 22:51:20 UTC
Obtaining DOMHelper
I'm trying to adapt an extension function that used to work before
some recent API changes in Xalan2. I had been using an AttList, but
that construction now requires a DOMHandler.
I've dug through the API a bit, but I haven't found the right methods,
I guess. Starting in an extension function, how can I find the current
DOMHandler?
Be seeing you,
norm
--
Norman.Walsh@Sun.COM | Someone has changed your life. Save? (y/n)
XML Standards Engineer |
Technology Dev. Group |
Sun Microsystems, Inc. |
Re: xsl:variable and xsl:param
Posted by John Keyes <jo...@yahoo.com>.
I have to investigate why it does not work with the
stylesheet I am using because I have written a very
simple one :
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:variable name = "NAME">My Name</xsl:variable>
<xsl:template match = "/">
<xsl:value-of select = "$NAME" />
</xsl:template>
</xsl:stylesheet>
and this works fine. Unfortunately I am not in a position
to post the one I am working on. If I find out the reason
behind the behaviour I will inform the list.
Thanks,
-John K
Gary L Peskin wrote:
> John --
>
> Can you send your complete stylesheet? This should work.
>
> Gary
>
> John Keyes wrote:
>
>>Hi guys,
>>
>>I have some xslt like the following:
>>
>> <xsl:stylesheet ... >
>> <xsl:variable ... />
>> <!-- OR -->
>> <xsl:param ... />
>>
>> <xsl:template ...>
>> </xsl:template>
>> </xsl:stylesheet>
>>
>>I get the following exception when performing a transformation:
>>javax.xml.transform.TransformerException:
>> xsl:variable is not allowed in this position in the stylesheet!
>>OR
>>javax.xml.transform.TransformerException:
>> xsl:param is not allowed in this position in the stylesheet!
>>
>>According to XSLT 1.1 Working Draft (http://www.w3.org/TR/xslt11/)
>>Section 11.4 Top-level Variables and Parameters, this is allowed.
>>
>>I searched Bugzilla but could not find the bug. If it is a bug
>>I will enter it into Bugzilla.
>>
>>-John K
Re: xsl:variable and xsl:param
Posted by Gary L Peskin <ga...@firstech.com>.
John --
Can you send your complete stylesheet? This should work.
Gary
John Keyes wrote:
>
> Hi guys,
>
> I have some xslt like the following:
>
> <xsl:stylesheet ... >
> <xsl:variable ... />
> <!-- OR -->
> <xsl:param ... />
>
> <xsl:template ...>
> </xsl:template>
> </xsl:stylesheet>
>
> I get the following exception when performing a transformation:
> javax.xml.transform.TransformerException:
> xsl:variable is not allowed in this position in the stylesheet!
> OR
> javax.xml.transform.TransformerException:
> xsl:param is not allowed in this position in the stylesheet!
>
> According to XSLT 1.1 Working Draft (http://www.w3.org/TR/xslt11/)
> Section 11.4 Top-level Variables and Parameters, this is allowed.
>
> I searched Bugzilla but could not find the bug. If it is a bug
> I will enter it into Bugzilla.
>
> -John K
>
> Gary L Peskin wrote:
>
> > Hi, Norm --
> >
> > No, you're not missing something obvious. ExpressionContext was added
> > as an interface when there was some talk of standardizing extension
> > handling. I don't know what the status of XSLT 2.0 is, which presumably
> > will address extension issues, but we can certainly add methods to
> > ExpressionContext so that you don't have to feel so "fragile". We'll
> > worry about 2.0 when it comes. You're pretty safe with the current
> > implementation casting the first argument to XPathContext but, as you
> > say, it's not guaranteed.
> >
> > Let me know if you want to add ExpressionContext methods that would be
> > generally useful.
> >
> > Gary
> >
> > Norman Walsh wrote:
> >
> >>/ "Paul Brown" <pr...@fivesight.com> was heard to say:
> >>| > I've dug through the API a bit, but I haven't found the right
> >>| > methods, I guess. Starting in an extension function, how can I
> >>| > find the current DOMHandler?
> >>|
> >>| DOMHandler is returned from TransformerImpl.getXPathContext.getDOMHelper();
> >>| that will get you the DOMHelper for the current execution context.
> >>
> >>Hmm. It appears to me that ExpressionContext is all I get passed to
> >>my extension function. Given that the API docs indicate that XPathContext
> >>is the only implementation of that interface, it seems reasonable that
> >>I could cast it, but that strikes me as a bit fragile. Am I missing
> >>something obvious?
> >>
> >> Be seeing you,
> >> norm
> >>
xsl:variable and xsl:param
Posted by John Keyes <jo...@yahoo.com>.
Hi guys,
I have some xslt like the following:
<xsl:stylesheet ... >
<xsl:variable ... />
<!-- OR -->
<xsl:param ... />
<xsl:template ...>
</xsl:template>
</xsl:stylesheet>
I get the following exception when performing a transformation:
javax.xml.transform.TransformerException:
xsl:variable is not allowed in this position in the stylesheet!
OR
javax.xml.transform.TransformerException:
xsl:param is not allowed in this position in the stylesheet!
According to XSLT 1.1 Working Draft (http://www.w3.org/TR/xslt11/)
Section 11.4 Top-level Variables and Parameters, this is allowed.
I searched Bugzilla but could not find the bug. If it is a bug
I will enter it into Bugzilla.
-John K
Gary L Peskin wrote:
> Hi, Norm --
>
> No, you're not missing something obvious. ExpressionContext was added
> as an interface when there was some talk of standardizing extension
> handling. I don't know what the status of XSLT 2.0 is, which presumably
> will address extension issues, but we can certainly add methods to
> ExpressionContext so that you don't have to feel so "fragile". We'll
> worry about 2.0 when it comes. You're pretty safe with the current
> implementation casting the first argument to XPathContext but, as you
> say, it's not guaranteed.
>
> Let me know if you want to add ExpressionContext methods that would be
> generally useful.
>
> Gary
>
> Norman Walsh wrote:
>
>>/ "Paul Brown" <pr...@fivesight.com> was heard to say:
>>| > I've dug through the API a bit, but I haven't found the right
>>| > methods, I guess. Starting in an extension function, how can I
>>| > find the current DOMHandler?
>>|
>>| DOMHandler is returned from TransformerImpl.getXPathContext.getDOMHelper();
>>| that will get you the DOMHelper for the current execution context.
>>
>>Hmm. It appears to me that ExpressionContext is all I get passed to
>>my extension function. Given that the API docs indicate that XPathContext
>>is the only implementation of that interface, it seems reasonable that
>>I could cast it, but that strikes me as a bit fragile. Am I missing
>>something obvious?
>>
>> Be seeing you,
>> norm
>>
>>--
>>Norman.Walsh@Sun.COM | It is good to have an end to journey toward;
>>XML Standards Engineer | but it is the journey that matters, in the
>>Technology Dev. Group | end.--Ursula K. Le Guin
>>Sun Microsystems, Inc. |
>>
>
Re: Obtaining DOMHelper
Posted by Gary L Peskin <ga...@firstech.com>.
Hi, Norm --
No, you're not missing something obvious. ExpressionContext was added
as an interface when there was some talk of standardizing extension
handling. I don't know what the status of XSLT 2.0 is, which presumably
will address extension issues, but we can certainly add methods to
ExpressionContext so that you don't have to feel so "fragile". We'll
worry about 2.0 when it comes. You're pretty safe with the current
implementation casting the first argument to XPathContext but, as you
say, it's not guaranteed.
Let me know if you want to add ExpressionContext methods that would be
generally useful.
Gary
Norman Walsh wrote:
>
> / "Paul Brown" <pr...@fivesight.com> was heard to say:
> | > I've dug through the API a bit, but I haven't found the right
> | > methods, I guess. Starting in an extension function, how can I
> | > find the current DOMHandler?
> |
> | DOMHandler is returned from TransformerImpl.getXPathContext.getDOMHelper();
> | that will get you the DOMHelper for the current execution context.
>
> Hmm. It appears to me that ExpressionContext is all I get passed to
> my extension function. Given that the API docs indicate that XPathContext
> is the only implementation of that interface, it seems reasonable that
> I could cast it, but that strikes me as a bit fragile. Am I missing
> something obvious?
>
> Be seeing you,
> norm
>
> --
> Norman.Walsh@Sun.COM | It is good to have an end to journey toward;
> XML Standards Engineer | but it is the journey that matters, in the
> Technology Dev. Group | end.--Ursula K. Le Guin
> Sun Microsystems, Inc. |
Re: Obtaining DOMHelper
Posted by Norman Walsh <nd...@nwalsh.com>.
/ "Paul Brown" <pr...@fivesight.com> was heard to say:
| > I've dug through the API a bit, but I haven't found the right
| > methods, I guess. Starting in an extension function, how can I
| > find the current DOMHandler?
|
| DOMHandler is returned from TransformerImpl.getXPathContext.getDOMHelper();
| that will get you the DOMHelper for the current execution context.
Hmm. It appears to me that ExpressionContext is all I get passed to
my extension function. Given that the API docs indicate that XPathContext
is the only implementation of that interface, it seems reasonable that
I could cast it, but that strikes me as a bit fragile. Am I missing
something obvious?
Be seeing you,
norm
--
Norman.Walsh@Sun.COM | It is good to have an end to journey toward;
XML Standards Engineer | but it is the journey that matters, in the
Technology Dev. Group | end.--Ursula K. Le Guin
Sun Microsystems, Inc. |
RE: Obtaining DOMHelper
Posted by Paul Brown <pr...@fivesight.com>.
> I've dug through the API a bit, but I haven't found the right
> methods, I guess. Starting in an extension function, how can I
> find the current DOMHandler?
DOMHandler is returned from TransformerImpl.getXPathContext.getDOMHelper();
that will get you the DOMHelper for the current execution context.
- Paul