1

Possible Duplicate:
Add an attribute with static value with xslt

I have an XML file which I need to modify.

For example:
Say my XML has a form tag

<FORM name=""></FORM>

Now say I want to put some extra info to this tag like

frame="frmName" frameby="name"

Expected result of running batch file OR some XSLT

<FORM name="" frame="frmName" frameby="name" ></FORM>

How can I do it using batch file?
I am just a beginner so please try to be simple.

Thank you all

3

1 Answer 1

2

Have you considered using XSLT to modify the XML, as further explained here

EDIT

xlst solution

<xsl:template match="FORM">
 <xsl:copy>
   <xsl:attribute name="name">frmName</xsl:attribute>
   <xsl:apply-templates select="node()|@*/>
  </xsl:copy>
 </xsl:template>
Sign up to request clarification or add additional context in comments.

9 Comments

yes I would like to use XSLT.+1 for your answer,let me test it before I could accept it.
I don't know what is going on here, could you please provide some simple answer specific to my question.
@mohit Could you elaborate? The answer give details how to solve the problem using different tool (XSLT vs batch file). How can I be more specific?
This is not working at all, it shows an exception on my browser saying "not well formed XML".I don't know what I am missing.Also I am trying to achieve something slightly different, please have a look at the question.
It would help if you would include the whole xml (the one the shows not well formed XML).
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.