On Saturday, May 10, 2003, at 11:30 AM, Hussein Shafie wrote:
> Jeremy Quinn wrote:
>>
>> I have been reading the dox for powerusers for the new XXE 2.3.
>> Some very nice additions!
>>
>> I would like to request a new feature which would help us enormously
>> (or happily accept suggestions for a workaround ....).
>>
>> Would it be possible to get a way of stripping a specific prefix
>> and/or
>> suffix (ideally setup in the config file) from the Paths returned by
>> the 'file-name-field' widget?
>>
>> Our XML documents contain application-specific path-stubs to other
>> resources, in attributes and elements:
>>
>> <image src="archive/project/asset.jpg"/>
>> which has the following absolute paths:
>> file:///Library/Apache2/htdocs/assets/archive/project/asset.jpg
>> http://www.server.org/assets/archive/project/asset.jpg
>>
>> <href>season/soft/about</href>
>> which has the following absolute paths:
>> file:///Users/Shared/Site/Content/season/soft/about.xml
>> http://www.server.org/[command/]season/soft/about
>>
>> <component src="archive/projects-menu"/>
>> which has the following absolute paths:
>> file:///Users/Shared/Site/Components/archive/projects-menu.xml
>> cocoon:/components/archive/projects-menu (internal url for
>> aggregation)
>>
>> We use these partial paths because we serve our XML via Apache Cocoon
>> (which excels at abstracting URLs from resources), using XSLT to
>> manipulate these paths according to the WebApp's requirements. (We
>> call
>> this Application root addressed).
>>
>> (I imagine those writing Static XHTML, who use aliases to serve
>> images,
>> would also face the same kind of issue.)
>>
>> Currently, in the case of the <image src="blah"/> we use the attribute
>> pane's file browser to locate the relevant image, hand-edit the
>> spurious absolute path prefix and have it displayed with the following
>> CSS:
>>
>> image {
>> content:
>> concatenate("image('http://dev.local/assets/", attr(src),
>> "', attr(width), attr(height))");
>> }
>>
>> This all works very well, except for the error-prone hand editing.
>
> OK, I'll add 2 new boolean parameters to the file-name-field: basename
> (default no) and extension (default yes).
>
> basename=yes means that you just want the basename of the file (ex.
> logo.jpeg) rather than its absolute or relative path.
> extension=no means that you want to strip the extension (ex. .jpeg)
> from
> the absolute or relative path or basename returned by the file chooser.
Thanks for the offer to do this, but it will not actually help us in
this situation. Except for the suffix bit.
Most of our 'path stubs' contain '/'.
We would need a 'base' url to start from (ie. to strip from the
beginning of the urls that get written into the document).
What about one string param and two booleans:
suffix: TRUE|FALSE - use suffix, yes or no
filename: TRUE|FALSE - use only the file name, not any of the path,
yes or no
base: STRING - XML document/server root to be stripped from paths
regards Jeremy