Jump to content

Element value to attribute value


premrajani

Recommended Posts

Hi, Using Web API, I retrive data from a tool in format given below. This is done using a built-in API methods of the tool. <Record><Field id="6233" type="1">APAC - Hong Kong</Field><Record> Now my problem is using XSLT is it possible to change the format to below shown format and how. I'm still learning and finding it tough to achieve it. <Record><Field id="6233" type="1" value="APAC - Hong Kong"></Field><Record>

Link to comment
Share on other sites

Put the two templates

<xsl:template match="@* | node()">  <xsl:copy>    <xsl:apply-templates select="@* | node()"/>  </xsl:copy></xsl:template> <xsl:template match="Field/text()">  <xsl:attribute name="value">	 <xsl:value-of select="."/>  </xsl:attribute></xsl:template>

into a stylesheet and it should work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...