|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to add a string to an attribute
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.Uslu@xxxxxxxxxx>
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
|
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








