Thanks, Hussein. 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 -- but in XHTML, @id is of type ID -- I could package up the XPath search for @id in a custom function - say, element(id).
/Roy -----Original Message----- From: Hussein Shafie [mailto:[email protected]] Sent: 20 October 2010 11:36 To: Roy MacLean Cc: [email protected] Subject: Re: [XXE] Spreadsheet formulas in DITA topic Roy MacLean wrote: > > I've just been trying out the Spreadsheet extensions to XXE. This is really > interesting, and a very neat solution. > > One question though. I've worked through the tutorial, which is obviously on > an XHTML document. For me, I'd want to do this on a DITA topic. However, in > the latter document, I can't get the formulas to work with element ids. > > So I have: > <p>In 2009 we made £<ph id="previous">234</ph></p> > > But the formula: > <p>Previous = <?xxe-formula formula='=$(previous)'?></p> > does not return a result (but no error). > > However, the XPath version: > <p>Previous = <?xxe-formula formula='=`//*...@id='previous']`'?></p> > does work. > > Similar behaviour happens when the referenced element is a <stentry>. > > What am I doing wrong here? Nothing wrong. The "id" attribute of a topic, concept, task, etc, elements is an actual ID (ID in capital case). The "id" attribute of all the other elements are mere NMTOKENs. See http://docs.oasis-open.org/dita/v1.1/OS/langspec/common/id-atts.html. That's why something like "$(previous)", which means the element having "previous" as its ID, whatever the name of the attribute used to specify it, cannot work. Note that is not difficult to create and register with XXE your own custom spreadsheet functions. See http://www.xmlmind.com/xmleditor/_distrib/doc/spreadsheet/custom_functions.h tml. Doing that will spare you the effort of having to type //*...@id="XXX"] in all your formulas. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Roy MacLean -- IT Training & Technical Writing > http://roymaclean-it.co.uk > [email protected] > 07 956 474 911 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ======= 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

