Please try the XSL --
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<questestinterop>
<xsl:for-each select="questestinterop/item">
<item title="{concat(position(), '_',
@title)}">
<xsl:copy-of select="itemmetadata" />
</item>
</xsl:for-each>
</questestinterop>
</xsl:template>
</xsl:stylesheet>
Regards,
Mukul
--- "Uslu, Cihan Y (MED)" <Cihan(_dot_)Uslu(_at_)med(_dot_)ge(_dot_)com>
wrote:
Hi,
Following is the XML snippet that I'm working with;
<questestinterop>
<item title="TT-1003_Mod01_Objective01_Title:"
ident="5112114679096874">
<itemmetadata>
<qmd_itemtype>Multiple Choice</qmd_itemtype>
<qmd_status>Normal</qmd_status>
<qmd_toolvendor>Vendor</qmd_toolvendor>
<qmd_topic>Biomed Training\TT-1003</qmd_topic>
</itemmetadata>
<item>
<item title="TT-1003_Mod01_Objective01_Title:"
ident="5112114679096874">
<itemmetadata>
<qmd_itemtype>Multiple Choice</qmd_itemtype>
<qmd_status>Normal</qmd_status>
<qmd_toolvendor>Vendor</qmd_toolvendor>
<qmd_topic>Biomed Training\TT-1003</qmd_topic>
</itemmetadata>
<item>
....
....
</questestinterop>
What I want to do is; to count the item element and
add this value in
front of title attribute and copy the rest of the
information as it is.
What is the best way of doing this?
This is the desired output;
<questestinterop>
<item title="001_TT-1003_Mod01_Objective01_Title:"
ident="5112114679096874">
<itemmetadata>
<qmd_itemtype>Multiple Choice</qmd_itemtype>
<qmd_status>Normal</qmd_status>
<qmd_toolvendor>Vendor</qmd_toolvendor>
<qmd_topic>Biomed Training\TT-1003</qmd_topic>
</itemmetadata>
<item>
<item title="002_TT-1003_Mod01_Objective01_Title:"
ident="5112114679096874">
<itemmetadata>
<qmd_itemtype>Multiple Choice</qmd_itemtype>
<qmd_status>Normal</qmd_status>
<qmd_toolvendor>Vendor</qmd_toolvendor>
<qmd_topic>Biomed Training\TT-1003</qmd_topic>
</itemmetadata>
<item>
....
....
</questestinterop>
...........
Thanks,
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list