I need some help on a specific part of an XSLT I have produced.
I have a DAO recordset with the following fields ("and data")
Field_1 ("Shop")
Field_2 ("London")
Field_3 ("Angels")
The resulting XML must look like:
<?xml version="1.0"?>
<root>
<Shop>
<LocationTown>London</LocationTown>
<EntryName>Angels</EntryName>
</Shop>
</root>
So my xslt will be....
<xsl:stylesheet xmlns:xsl=" <xsl:template match="/">
<Shop>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Shop>
</xsl:template>
<xsl:template match="//z:row">
<Name>
<LocationTown>
<xsl:value-of select="@Field_2"/>
</LocationTown>
<EntryName>
<xsl:value-of select="@Field_3"/>
</EntryName>
</xsl:template>
</xsl:stylesheet>
The data in field_1 will only ever be one of two values (Shop or Factory), but I cannot get that value to dictate the name of the node.
I would basically like to say:
<xsl:template match="/">
<xsl:if test="@Field_01='Shop'"
<Shop>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Shop>
<xsl:if>
<xsl:if test="@Field_01='Factory'"
<Factory>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Factory>
<xsl:if>
</xsl:template>
If the data is 'Shop', have an element of <Shop>.. if the data is 'Factory'.. have entry of <Factory>
Is this possible?
------------------------
Hit any User to continue
I have a DAO recordset with the following fields ("and data")
Field_1 ("Shop")
Field_2 ("London")
Field_3 ("Angels")
The resulting XML must look like:
<?xml version="1.0"?>
<root>
<Shop>
<LocationTown>London</LocationTown>
<EntryName>Angels</EntryName>
</Shop>
</root>
So my xslt will be....
<xsl:stylesheet xmlns:xsl=" <xsl:template match="/">
<Shop>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Shop>
</xsl:template>
<xsl:template match="//z:row">
<Name>
<LocationTown>
<xsl:value-of select="@Field_2"/>
</LocationTown>
<EntryName>
<xsl:value-of select="@Field_3"/>
</EntryName>
</xsl:template>
</xsl:stylesheet>
The data in field_1 will only ever be one of two values (Shop or Factory), but I cannot get that value to dictate the name of the node.
I would basically like to say:
<xsl:template match="/">
<xsl:if test="@Field_01='Shop'"
<Shop>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Shop>
<xsl:if>
<xsl:if test="@Field_01='Factory'"
<Factory>
<xsl:for-each select="//rs:data">
<xsl:apply-templates/>
</xsl:for-each>
</Factory>
<xsl:if>
</xsl:template>
If the data is 'Shop', have an element of <Shop>.. if the data is 'Factory'.. have entry of <Factory>
Is this possible?
------------------------
Hit any User to continue