xsl-list
[Top] [All Lists]

[xsl] xsl:import and use-when

2014-05-15 15:21:05
Hi,

I have been experimenting with xsl:import@use-when to override templates 
imported by the main stylesheet module with 
an import@href value (partially) generated by a filtered maven variable.  
Because the file so referenced may or may not exist, I've tried
to apply the @use-when attribute as follows:

  <xsl:import href="feedOrEntry2json-default.xsl"/>     
  <xsl:import href="feedOrEntry2json-api.xsl" 
use-when="doc-available('feedOrEntry2json-api.xsl')"/>

The string 'api' is generated by the filtered maven  variable, and the file 
does exist in the same directory as the importing stylesheet
(when I execute the doc-available('feedOrEntry2json-api.xsl') call in the xpath 
tester in oxygen, I get 'true' as a result).

However, when I execute the stylesheet, the templates in the first import are 
(incorrectly) not overridden.   
If I remove the @use-when, they are (correctly) overridden, but of course I 
can't do that in general because sometimes the file won't 
exist and in that case I don't want the compilation to fail, hence the 
@use-when.

Any advice appreciated, with thanks.

Peter Rushforth
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>