Philip Nye wrote:
> Thanks Hussein, I have just managed to solve the problem for my own
> application. FYI here is what I've done.
> 
> For my particular application the URLs I want to resolve via a catalog
> are not arbitrary but are all relative to just one or two base locations
> which can be "hard coded" into my configuration but which need the
> catalog resolution.
> 
> I have found I can get exactly the result I need by declaring those
> locations using this:
> 
>   <property
>     url="true"
>     name="BASE_LOCATION">location:/to/resolve/via/catalog</property>
> 
> If I then have a relative URL in variable $relURL, this then resolves
> via the catalog when my macro contains:
> 
>   <get expression="sys:getProperty('BASE_LOCATION')"/>
>   <get expression="resolve-uri($relURL, %_"/>
>   <command name="viewHTML" parameter="%_"/>
> 
> I looks as though the base location is resolved when the configuration
> is read rather than when it is used. Is this the case? 

That's right. Using the <property> configuration element, the system
property is set once for all at XXE startup time.



> Can I write something like this:
> 
>   <get expression="sys:setProperty('BASE_LOCATION', $new_value)"/>
> 
> and have the new location resolve via the catalog?
> 

Yes, in principle, this should work.



---
PS: You can replace sys:getProperty() (but not sys:setProperty()) by
standard function system-property(). See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathfunc.html
and http://www.w3.org/TR/xslt#function-system-property

Reply via email to