 22 Nov 2013, at 21:06, G. Ken Holman <gkholman@...> wrote:
> At 2013-11-22 22:01 +0100, Christian Mahnke wrote:
>> Hi again,
>> I've found the reason already, it only works for document nodes:
>>
>>
>> I'll try to make up an function that tries to solve this, It should
>> work if I walk the list of ancestors until I find a document node, right?
>
> Or just use: document-uri(root(.))
>
Or just document-uri(/)
Michael Kay
Saxonica
On 22 Nov 2013, at 21:34, G. Ken Holman <gkholman@...> wrote:
> At 2013-11-22 16:27 -0500, Graydon Saunders wrote:
>> Or base-uri(.)
>>
>> Or if you want the _executable_ uri, static-base-uri()
>
> Actually, base-uri(.) will only return the same value in a monolithic
> input XML document. If you are using external parsed general
> entities and the node is in an external entity, base-uri(.) will give
> you the URI of the external entity.
base-uri() and document-uri() may also differ if the document contains xml:base attributes,
and probably under some other circumstances as well, e.g. if the URI used to request a document using document() is different from the URI that comes back in the SystemID property of the returned Source object.
Michael Kay
Saxonica
>
> There is ongoing work standardizing a file: extension
> () which obviously raises similar issues.
> Perhaps Saxon will deal with this in a sensible way as part of that effort?
>
What would you consider a sensible way?
There's no easy way to make side-effecting function calls behave predictably and intuitively in a language that is otherwise declarative and side-effect-free.
A lot of the problems arise because people expect sequential semantics for constructs that do not have sequential semantics defined.
Michael Kay
Saxonica
Maybe you could use
<xsl:sequence
Since an empty sequence is generated by your function, xsl:sequence
generates an empty sequence, and the output is left unchanged.
2013/11/22 Steve Carton <steve@...>
> I have a java XSLT extension function which I need to call to update
> certain state information. It has no return (public void add(...))
>
> How do I make a call to this function? Since it isn't returning anything,
> it makes no sense to put it in an xsl:value-of. I tried assigning it to a
> variable, but it looks like variables don't actually get created until they
> are being used? The only way I got this to work was to then emit the
> (empty) variable in a comment in the output. But I don't need a bunch of
> empty comments in the output.
>
> Is there another way in either Saxon or XSLT 2 in general to accomplish
> this? Is there a trick to make the extension function call at the time of
> variable assignment instead of use?
>
> --
> *Steve* Carton
>
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up
> now.
>
> _______________________________________________
> saxon-help mailing list archived at
> saxon-help@...
>
>
--
Envoyé depuis Firefox et analysé grâce à Hadoop par la NSA (via Gmail©®™) 😏
I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details