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.




> 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 "..".


Reply via email to