|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Generating Unique ID
Arun,
You can take a look at: http://www.electronicsolutionsco.com/XMLEdit/XSLT/XMLEditBasicForm.xslt http://www.electronicsolutionsco.com/XMLEdit/XSLT/XMLEditBaseElements.xslt In XMLEditBasicForm.xslt, I create heirarchical id's for div and span elements. Search for "id=" in the file and you'll find text such as: div id="{$div_name}"
span id="{$span_name}"where $div_name was formed from an id created by the template function found in XMLEditBaseElements.xslt: create_path() create_path() creates addresses (id's) based upon the hierarchical location of an element within the XML file being transformed. (The id's are heirarchical but not necessarily sequential, e.g. there may be gaps in the numbering.) If there is a reasonable correlation between the structure of the XML file and the resulting HTML, this may work for you. If not, it may at least give you some ideas. FAIR WARNING: My implementation of create_path(), to put it mildly, [expletive deleted]. Despite my efforts to do a fully recursive version, I could never get it to work. So in the interest of expediency, I did a version which I believe nests to about 5 or 6 levels, but it is brute force and not at all elegant. Feel free to improve upon it as you may. These files are part of the XMLEdit demo found at: http://www.electronicsolutionsco.com/XMLEdit XMLEdit is a limited function CMS where content is stored in XML files and manipulated through xslt and javascript to change the public website. You can edit the XML in a strictly defined manner and then preview and publish the page. The hierarchical id's are used while editing the XML content. You can see the xslt that uses these id's in action by editing: http://www.electronicsolutionsco.com/XMLEdit/xml/demo.xml Underneath the "Preview Page" button, near the bottom of the page, are two buttons to view either the underlying XML data for the page or the transformed HTML that created the page. Hope this helps. -- Steve Rosenberry Sr. Partner Electronic Solutions Company -- For the Home of Integration http://ElectronicSolutionsCo.com (610) 670-1710 Arun Sinha wrote: Hi Ragulf,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








