Re: [xsl] problem: getting link text without document() function

Subject: Re: [xsl] problem: getting link text without document() function
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 11 Sep 2018 11:15:56 -0000
> This list seems to have gone dormant but here goes

I think most of the simple coding questions that used to dominate this list
are now posted on StackOverflow, which benefits from much better search and
filtering options. I'm told that some people get great kudos from the brownie
points that StackOverflow awards its members.
>
> I have a working XSLT 1 stylesheet which determines the text to insert in
> hyperlinks by identifying the linked elements in separate documents. I'm
now
> incorporating it into an application which uses Xopus to edit a source XML
> document, and I have discovered that the stylesheet is only usable in IE.
> Unfortunately it barfs in Chrome and Firefox, because whatever XSL
processor
> they use in those browsers does not support document(). The Xopus
> documentation implies that whatever I am trying to achieve in this
> stylesheet could be achieved using XIncludes (but they don't supply a
useful
> example for my requirement).

What kind of URI are you supplying to document()? Are you trying to get a
document from the server using HTTP, or a document in the local filestore of
the client machine?

The problem with document() in client-side transformations is (a) requests to
the server will typically be synchronous, which is bad news in the browser;
also you get into difficulties with cross-site scripting; (b) requests to get
files from the client machine are usually banned for security reasons, though
you may be abe to override the security settings.
>
> I have to concede that I was even less informed when I wrote this
stylesheet
> than I am now, so it may be horribly over-engineered and misguided - but at
> least it has been working in IE (and in other contexts outside
> Xopus-in-a-browser).
>
> If anyone is able to direct me to a useful example, or provide some tips on
> how to achieve what I am doing without using document(), I would be very
> grateful.
>
You could consider using Saxon-JS, which supports asynchronous HTTP requests
to get resources (and also supports XSLT 3.0 rather than 1.0)

> By the way, can anyone tell me what has happened to Dave Pawson's
invaluable
> XSLT FAQ? I remember using it almost daily for a while and I feel a great
> loss now that its seems to have vanished from the web
>

Ask Dave? But it had become rather sprawling, and in some respects rather out
of date.

Michael Kay
Saxonica

Current Thread