Re: [xsl] should document-uri work like this?

Subject: Re: [xsl] should document-uri work like this?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 01 Jan 2011 21:36:55 -0500
At 2011-01-01 18:23 -0800, Fred Christian wrote:
What I think I want to do is find a way to get the document() function
to resolve relative URI's based on the href of the current
<xsl:result-document>

I have noticed that <xsl:result-document> is resolving my relative URI
based on the main output file (as specified).
And that document() is resolving the relative URI based on the source
XSL file (I think as specified).

Depends ...


 - document(relative-uri) is relative to the stylesheet
 - document(relative-uri,node) is relative to the source tree node base URI

Because those two are resolving based on different things, I am stuck.

Is is possible to somehow test for the existence of a xml file that is
in the output path when the output path isn't directly known to the
xsl code?

Not using the standard, perhaps based on a vendor extension that I don't know of.


For example.
<xsl:result-document href="01/section.html">
do common stuff
{{If there is a 01/moreinfo.xml then do extra stuff}}
</xsl:result-document>

Note: the 01/section.html file is getting created properly.

When I try to use
<xsl:if test="document('01/moreinfo.xml')">
do extra stuff
</xsl:if>

It doesn't work unless, for testing purposes, I copy my 01 directory
into the directory my source XSL file is at.

Yes, that is consistent with the specification.


re: collection()
Hmmm, read through how that works. I don't have a good way to use a
catalog file (one doesn't exist). I can't use regular expression
because there is no parsable path from the source xsl file to the
output xml file.

New idea.
Maybe I can supply a param in my command line that I can use to let
the XSL know the path to output files.

Yes, that seems viable to me.


I was hoping to make the transform logic to be completely in XSL though.

The output URI is not directly addressable in order to make it a property for input. As you have found, it is only addressable as a property with which relative URIs for output can be based.


I hope this helps, though I realize it doesn't give you what you want.

. . . . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread