This is my first post on here and I am hoping someone will be able to help me as I have been racking my brain for ages trying to access a particular element in my XML using my existing XSL. I have searched the site and have come close to finding the answer but it was never exactly what I was looking for.
The new element I am trying to process is , ideally I am looking to be able to reference the 'Label' within NOTE to extract the corresponding value. For example, in the below XML I would like to be able to extract the value of the "Unit" label which is KT and store that in <UOM>.
The XML is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<TYRE xmlns="gapi-tyre-com" Action="Update">
<INSTSPECIFIER SEQ="10000"/>
<TERM Default="" Desc="" Label="Execution" Type="string">MTT</TERM>
<ANNOTATIONS>
<NOTE Label="CP">2013-12-03T15:38:48.931</NOTE>
<NOTE Label="CPR">UK</NOTE>
<NOTE Label="Unit">KT</NOTE>
<NOTE Label="UnitID">10000554</NOTE>
</ANNOTATIONS>
</TYRE>
The current XSL I have is:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0.001 -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:g="gapi-tyre-com"
exclude-result-prefixes="g">
<xsl:output method="xml" indent="yes" doctype-public="importFile" doctype-system="importer.dtd"/>
<xsl:template match="/">
<xsl:element name="importFile">
<xsl:attribute name="source">T</xsl:attribute>
<xsl:attribute name="template">default</xsl:attribute>
<xsl:apply-templates select="g:TYRE"/>
</xsl:element>
</xsl:template>
<xsl:template match="g:TYRE">
<TYREImport>
<xsl:choose>
<xsl:when test="@Action = 'Remove'">
<audit>DELETE</audit>
</xsl:when>
<xsl:otherwise>
<audit>NEW</audit>
</xsl:otherwise>
</xsl:choose>
<type>F</type>
<period>H</period>
<ABCD>D</ABCD>
<TYREtype2>P</TYREtype2>
<mt>F</mt>
<memo1> MTT , <xsl:value-of select="g:INSTSPECIFIER/@SEQ"/></memo1>
</TYREImport>
</xsl:template>
</xsl:stylesheet>
Any help would be much appreciated on this.