Jump to content

Element value to attribute value

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...