RE: XML Calabash V0.9.20 released

> > On 6 April 2010 21:07, Norman Walsh wrote:
> >
> >>  <p:with-option name="href" select="concat(cxf:cwd(), "/foo.txt")"/>
> >
> >   Sounds like resolve-uri(cxf:cwd(), 'foo.txt') to me ;-)
> 
> Yeah, that would amount to the same thing. So the real world use cases
> were a little more complex. Things like this:
> 
>   select="concat(cxf:cwd(), '/examples/', $name)"
> 
> which amount to
> 
>   select="resolve-uri(cxf:cwd(), concat('/examples/', $name))"
> 
> which is a little more tedious. Of course, they also amount to
> this:
> 
>   select="concat(cxf:cwd(), 'examples/', $name)"
> 
> if you just remember that cxf:cwd() always ends with a slash.
> 
> My problem, and what motivated my change, is that I kept thinking that
> cxf:cwd() was going to behave like cwd() in Perl or Python and so I'd
> get extra slashes and such.
> 
> Now, maybe the right answer is, I should stop thinking in terms of
> scripting languages and directories and think in terms of XML and
> URIs.
> 

For my part, I agree with Florent on this one. Having the trailing slash is more consistent with what the URI spec says about directories, plus it does not introduce any weird behavior to the resolve-uri functionality. (But really, I think you really should avoid using concat for paths/URIs in XProc :)

Regards,
Vojtech

Received on Wednesday, 7 April 2010 09:55:02 UTC