Reputation: 21
I have a XML and need to convert this into another XML using XSL. I'm quite new to XSL and need help. I'm using Oracle JDeveloper to build the XSL.
I need to provide a XML output that looks like:
<NumericField id="456">1</NumericField>
where 456 and 1 come from variable that will be defined using
<xsl:value-of select="/XYZ/ASDF"/>
I tried this using many ways but always end up with errors or undesired output. Can you help how my XSL should look like.
Currently this is how my XSL looks like which is incorrect:
<NumericField id= "<xsl:value-of select="/XYZ/ASDF"/>" >
<xsl:value-of select="/XYZ/DSAF"/>
</NumericField>
Upvotes: 2
Views: 66
Reputation: 52858
Example of AVT (attribute value template) mentioned in the comments...
<NumericField id="{/XYZ/ASDF}">
<xsl:value-of select="/XYZ/DSAF"/>
</NumericField>
Upvotes: 0
Reputation: 909
Here is the code
<xsl:element name="NumericField">
<xsl:attribute name="id">
<xsl:value-of select="/XYZ/ASDF"/>
</xsl:attribute>
<xsl:value-of select="/XYZ/DSAF"/>
</xsl:element>
Upvotes: 2