Hi,
Has anyone tried to set up an xsl stylesheet to get dxl item values in to bs7666 address formats from the published govtalk schemas? I cant quite seem to identify one dxl item and then use values from other items to populate the nested bs7666 elements. eg
<xsl:template match=“dxl:item”>
<xsl:choose>
<xsl:when test="@name='Adress'">
<IncidentLocation>
<fire:Adress>
<!--xsl:choose>
<xsl:when test="@name='Building_Name_Number'"-->
<bs7666:PAON>
<bs7666:StartRange>
<bs7666:Number>
<xsl:value-of select="dxl:item[@name='Building_Name_Number']/dxl:text" />
</bs7666:Number>
</bs7666:StartRange>
</bs7666:PAON>
<!--/xsl:when>
</xsl:choose-->
</fire:Adress>
</IncidentLocation>
</xsl:when>
</xsl:choose>
</xsl:template>
Subject: XSLT DXL and GovTalk address elements
Gee thanks guys for the help.
I’ve find a solution and will post extract of xslt here in case anyone else has a similar problem. Its related to XPATH and node navigation. Ive used “nested” templates and used “…/” to go up one level to get the item values
<xsl:template match="dxl:item[@name='Building_Name_Number']">
<xsl:element name="bs7666:PAON">
<xsl:element name="bs7666:StartRange">
<xsl:element name="bs7666:Number">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name='Street']">
<xsl:element name="bs7666:StreetDescription">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name='Locality']">
<xsl:element name="bs7666:Locality">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name='Town']">
<xsl:element name="bs7666:Town">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name='County']">
<xsl:element name="bs7666:AdministrativeArea">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name="PostCode"]">
<xsl:element name="bs7666:PostCode">
<xsl:value-of select="dxl:text" />
</xsl:element>
</xsl:template>
<xsl:template match="dxl:item[@name='Adress']">
<xsl:element name="IncidentLocation">
<xsl:element name="fire:Adress">
<xsl:apply-templates select="../dxl:item[@name="Building_Name_Number"]" />
<xsl:apply-templates select="../dxl:item[@name="Street"]" />
<xsl:apply-templates select="../dxl:item[@name="Locality"]" />
<xsl:apply-templates select="../dxl:item[@name="Town"]" />
<xsl:apply-templates select="../dxl:item[@name="County"]" />
<xsl:apply-templates select="../dxl:item[@name="PostCode"]" />
</xsl:element>
</xsl:element>
</xsl:template>