XML / CSL Macros
-
Hi all, I am looking for some documentation of using macros or functions within XML. The program, Zotero, stores it data in a modified form of XML they call CSL. I am looking for means of manipulating authors that are all in uppercase within the controlling XML Reference Style, and capilizing the first letter then making the rest lowercase. e.g. lastname, LASTName, LastName --> Lastname. I would also like to capture things like McEwan and **O'**Reily. These simple types of text manipulations are found in many languages, e.g. lower(), upper(), proper() and instr(). What are the equivalents for use in XML? Simon
-
Hi all, I am looking for some documentation of using macros or functions within XML. The program, Zotero, stores it data in a modified form of XML they call CSL. I am looking for means of manipulating authors that are all in uppercase within the controlling XML Reference Style, and capilizing the first letter then making the rest lowercase. e.g. lastname, LASTName, LastName --> Lastname. I would also like to capture things like McEwan and **O'**Reily. These simple types of text manipulations are found in many languages, e.g. lower(), upper(), proper() and instr(). What are the equivalents for use in XML? Simon
SimonCropper wrote:
I am looking for means of manipulating authors
I am guessing that means the Text context of a TextNode which is of course a child of an ElementNode. It might be possible to accomplish this using Javascript and an XSLT Processor that supports user functions. I think I remember using one of the Microsoft Processors that supports that, perhaps they all do, I don't know because I would not use that mechanism unless I had no other choice. Fortunately, in this case you have another choice. Using a compiled programming language (C#, C++, whatever), load the file in a DOM, query for the elements of interest, read the current Text, modify the Text (your capitalization), write it back into the element. Finally the last step would be to persist the changed XML back into it's storage location, e.g. Disk File or Database or whatever.