As I am new to xslt, sorry if my question title is not correct!
my xml:
<workorder>
<wo>wo1234</wo>
<locspec>
<attrid>accessrd</attrid>
<attrvalue>nogothruroad</attrvalue>
</locspec>
<locspec>
<attrid>phone</attrid>
<attrvalue>99123</attrvalue>
</locspec>
<locspec>
<attrid>accessvehicle</attrid>
<attrvalue></attrvalue>
</locspec>
</workorder>
Desired output:
wo: wo1234
Road to access: nogothrurd
Phone number: 99123
Do you have vehicle access:
My xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="workorder">
<xsl:apply-templates select="wo" />
<xsl:apply-templates select="locspec" />
</xsl:template>
<xsl:template match="wo">
<xsl:text>wonum: </xsl:text><xsl:value-of select="." />
</xsl:template>
<xsl:template match="locspec">
<xsl:for-each select="locspec/attrid">
<xsl:text>Road to access: </xsl:text>
<xsl:value-of select="locspec/attrid"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Logic required is: if attrid is "accessrd" then get the attrvalue of it and if attrid is "phone" then get the attrvalue of it and if attrd is "accessvehicle" then get the attrvalue of it.
To be frank, I am not getting idea how to put xsl coding for my desired output. Please help me. Thanks in advance!
Current output is empty.