On 10/23/2010 1:24 AM, Hussein Shafie wrote:
> On 10/22/2010 11:24 PM, Andy Black wrote:
>> A user has a file name of
>>
>>       Me'phaa.xml
>>
>> and was trying to run a custom macro I had made.  The macro failed to work.
>>
>> When I debugged the macro and gave it the command
>>
>> <cfg:get expression="%{d}"/>
> I guess that this is a simplification of what you want to do because, as
> is, the above instruction does not make sense.
>
>
>
>> the result was:
>>
>> -->associatePublisherStylesheet:get: checking...
>>      cannot parse
>> expression='file:/C:/Documents%20and%20Settings/Andy%20Black/My%20Documents/XLingPap/Users/SteveMarlett/Me'phaa.xml':
>> bad character after :
>> <--associatePublisherStylesheet:get: CANNOT EXECUTE
>>
>> There is no problem when the file name does not have the apostrophe in it.
> With or without an apostrophe
>
> file:/C:/Documents%20and%20Settings/Andy%20Black/My%20Documents/XLingPap/Users/SteveMarlett/Me'phaa.xml
>
> is definitely not a valid XPath expression. There is nothing that can be
> changed in that fact.
>
>
>
>> Is there a solution to this other than not using a single quote in the
>> file name?
>>
> Probably, but I don't understand what is exactly the problem. Please
> consider sending me a less simplified version of your macro.

Sorry for not being clear.

Here is the full macro, including some of my alerts to try and figure 
out what was happening.  It uses a custom Java command 
(AssociatePublisherStylesheetCmd) that modifies the structure of the 
XML, but never got that far with a file name containing an apostrophe.

<cfg:command name="associatePublisherStylesheet">
<cfg:macro trace="true">
<cfg:sequence>
<cfg:choice>
<cfg:pass>
<cfg:command name="selectNode" 
parameter="ancestorOrSelf[implicitElement] lingPaper xlingpaper"/>
</cfg:pass>
<cfg:pass>
<cfg:command name="selectNode" 
parameter="descendantOrSelf[implicitElement] lingPaper  xlingpaper"/>
</cfg:pass>
</cfg:choice>
<cfg:command name="selectFile" parameter="[Choose Publisher Style 
Sheet]openFile 
%{c}/../publisherstylesheets/SILInternationalPaperStylesheet.xml"/>
<cfg:set variable="fileName" expression="%_" plainString="true"/>
<cfg:get expression="$fileName"/>
<cfg:command name="alert" parameter="After setting fileName: %_"/>
<cfg:get expression="%{d}"/>
<cfg:command name="alert" parameter="Percent d: %_"/>
<cfg:get expression="$fileName"/>
<cfg:get expression="relativize-uri(uri-or-file-name('%_'), '%{d}')"/>
<cfg:set variable="uri" expression="%_" plainString="true"/>
<cfg:command name="alert" parameter="Before invoking Java command"/>
<cfg:get expression="concat($fileName, '|', $uri)"/>
<cfg:command name="AssociatePublisherStylesheetCmd" parameter="%_"/>
<cfg:set variable="result" expression="%_" plainString="true"/>
<cfg:command name="alert" parameter="After invoking Java command"/>
<cfg:choice>
<cfg:sequence>
<cfg:test expression="string-length($result) &gt; 0"/>
<cfg:get expression="$result"/>
<cfg:command name="alert" parameter="%_"/>
</cfg:sequence>
<cfg:sequence>
<cfg:command name="XXE.save" parameter="[ifNeeded]"/>
<cfg:command name="XXE.open" parameter="%D"/>
</cfg:sequence>
</cfg:choice>
</cfg:sequence>
</cfg:macro>
</cfg:command>

--Andy

 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to