Brilliant.
Furthermore, I can return a nodeset with ids that share a common prefix (or
other substring):
<f:macro><![CDATA[=`//*[starts-with(@id,$idprefix)]`]]></f:macro>
If I had <ph> or <stentry> elements with ids all starting, say, "value",
then it becomes very easy to sum (or otherwise aggregate) these. It's a bit
of work to set up ids according to some useful scheme, but this could
obviously be done in a template.
You could even go further and use regular expression matching on ids (or
other attributes).
regards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Roy MacLean -- IT Training & Technical Writing
http://roymaclean-it.co.uk
[email protected]
07 956 474 911
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: Hussein Shafie [mailto:[email protected]]
Sent: 20 October 2010 13:37
To: Roy MacLean
Cc: '[email protected]'
Subject: Re: [XXE] Spreadsheet formulas in DITA topic
On 10/20/2010 01:07 PM, Roy MacLean wrote:
>
> Just to clarify:
> -- the ids referenced in XXE formulas must be IDs, not just NMTOKENs
> -- non-topic/map elements in DITA have @id of type NMTOKEN
Yes.
> -- but in XHTML, @id is of type ID
Yes, and the same in DocBook 4 (@id) and 5 (@xml:id).
> -- I could package up the XPath search for @id in a custom function - say,
> element(id).
Yes, simply add:
---
<spreadsheetFunctions location="custom_spreadsheet_functions.xml" />
---
to your customize.xxe and add attached custom_spreadsheet_functions.xml
file in the directory containing customize.xxe and you are done.
custom_spreadsheet_functions.xml is:
---
<f:functions xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://www.w3.org/1999/xhtml"
xmlns:f="http://www.xmlmind.com/xmleditor/schema/spreadsheet/functions">
<f:function>
<f:name>element</f:name>
<f:parameters>id</f:parameters>
<f:category>Custom</f:category>
<f:description>
<body>
<p>Returns a nodeset containing all the elements
(generally a single element)
having specified "id" attribute.</p>
</body>
</f:description>
<f:macro><![CDATA[=`//*...@id=$id]`]]></f:macro>
</f:function>
</f:functions>
--
It has been created using XXE after installing the "XMLmind XML Editor
Configuration Pack" add-on. Documentation of this add-on:
http://www.xmlmind.com/xmleditor/addons_doc.html#xxe_config_pack
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.18, Virus/Spyware Database: 6.16120)
http://www.pctools.com/
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.18, Virus/Spyware Database: 6.16120)
http://www.pctools.com/
=======
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support