On 15 Mar 2004, at 13:17, Hussein Shafie wrote:

> Jeremy Quinn wrote:
>> I am trying to make a command that will open a related document.
>> Using this snippet of xml:
>> <site xl:title="KISS">
>>  <map default="home" id="linkbase" role="reli" 
>> xl:href="/linkbase.xml" xml:base="xlink"/>
>>  <map xml:base="xml/" default="home" id="kiss" role="site">
>>   <ref xl:label="home" xl:href="home.xml" xl:title="Home Page of the 
>> KISS Rebreather Users Website">
>>    <name>KISS</name>
>>    <ref xl:label="work" xl:href="work/home.xml" xl:title="How the 
>> KISS Rebreather works">
>>     <name>Work</name>
>>     <ref xl:label="schematic" xl:href="work/schematic.xml" 
>> xl:title="A diagram showing how the unit works">
>>      <name>Schematic</name>
>>     </ref>
>> . . .
>> When you select the element r...@xl:label='work'] (above) I would 
>> like the command to select the value in the @xl:href to use to open 
>> that particular file:
>>  <command name="link.openDocument">
>>     <macro>
>>       <sequence>
>>         <command name="get" parameter="[implicitElement][URL] 
>> ./@{http://www.w3.org/1999/xlink}href"; />
>>         <command name="XXE.open" parameter="%_" />
>>       </sequence>
>>     </macro>
>>   </command>
>>   <menu label="LinkMap">
>>     <insert />
>>     <item label="Open Document" command="link.openDocument"/>
>>   </menu>
>> This works fine when I try to use an attribute that does not have a 
>> namespace prefix, but when I use the xl namespace, the menu item is 
>> always dimmed.
>
> See my answer about XXE non being namespace aware when the document 
> conforms to a DTD.
>
> If this is the case, changing "./@{http://www.w3.org/1999/xlink}href"; 
> to "./@xl:href" should fix the problem[*]
>
> ---
> [*] After rereading the code of command "get", I've found a bug in the 
> parser of the subset of XPath. "./@xl:href" should have worked, but 
> will not work due to the bug. Sorry.
>

So the previous fix you supplied to do with namespaces ( @xl\:href) 
won't work here?

>> Furthermore, when I get that selection working, I need to prepend the 
>> value '../' to the string returned from the attribute, before 
>> XXE.open is called. How do you do this ?
>> like this? :
>>   <command name="XXE.open" parameter='../"%_"' />
>> or this? :
>>   <command name="get"
>>     parameter="[implicitElement][URL] 
>> concat('../',./@{http://www.w3.org/1999/xlink}href)" />
>
> You'll have to wait for XXE V2.6 which will fully support XPath 1.0 at 
> various places, one of these places being the "get" command.
>
> XXE V2.5 only supports a very small subset of XPath (the subset needed 
> to validate XML-Schemas) and this subset does not include "..".

OK, I think my question was confusing, sorry.

I need to do the following:

1. read the value from @xl:href
2. prepend a modification to the value found in step 1, to 'correct' 
the filepath ie. ('../xml/'), to make it relative to the current 
document.
3. use the modified relative path value in the 'XXE.open' command, to 
open the document referenced by the @xl:href in XMLMind.

eg. if @xl:href contains the value 'work/schematic.xml' the value I 
need to pass to 'XXE.open' is '../xml/work/schematic.xml'.

I hope this is clearer.

Many thanks

regards Jeremy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2377 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20040316/33473960/attachment.p7s
 

Reply via email to