S
Scott Zabolotzky
I have the following XML sample:
<Component Name="A">
<Param Name="OptionEnabled" DataType="boolean">
<Default>true</Default>
</Param>
<Param Name="Size" DataType="unsignedInt"/>
<Param Name="Lifetime" DataType="unsignedInt">
<Default>5</Default>
</Param>
<Param Name="FullName" DataType="string"/>
<Param Name="Category" DataType="string">
<Default>Employee</Default>
</Param>
</Component>
I'm trying to generate an XSLT that will generate an HTML form
from the data. I'm having a problem figuring out how to use the
child element <Default>, if present, when generating a control for
each <Param> element.
Basically, if a <Param> element has a child element of <Default>
I want to use that to set the value of the control being created
for the <Param> element.
I have the following rule for <Param>:
<xsl:template match="Param">
<tr>
<td valign="top">
<xsl:value-of select="@Name" />
</td>
<td>
<xsl:if test="@DataType='boolean'">
<asp:CheckBox id="{@Name}" runat="server" />
</xsl:if>
<xsl:if test="@DataType='string'">
<asp:TextBox id="{@Name}" runat="server"></asp:TextBox>
</xsl:if>
<xsl:if test="@DataType='unsignedInt'">
<asp:TextBox id="{@Name}" runat="server"></asp:TextBox>
</xsl:if>
</td>
<xsl:apply-templates/>
</tr>
</xsl:template>
but I can't figure out how to reference the child element (if present)
to set the value of the various controls.
Can this be done?
<Component Name="A">
<Param Name="OptionEnabled" DataType="boolean">
<Default>true</Default>
</Param>
<Param Name="Size" DataType="unsignedInt"/>
<Param Name="Lifetime" DataType="unsignedInt">
<Default>5</Default>
</Param>
<Param Name="FullName" DataType="string"/>
<Param Name="Category" DataType="string">
<Default>Employee</Default>
</Param>
</Component>
I'm trying to generate an XSLT that will generate an HTML form
from the data. I'm having a problem figuring out how to use the
child element <Default>, if present, when generating a control for
each <Param> element.
Basically, if a <Param> element has a child element of <Default>
I want to use that to set the value of the control being created
for the <Param> element.
I have the following rule for <Param>:
<xsl:template match="Param">
<tr>
<td valign="top">
<xsl:value-of select="@Name" />
</td>
<td>
<xsl:if test="@DataType='boolean'">
<asp:CheckBox id="{@Name}" runat="server" />
</xsl:if>
<xsl:if test="@DataType='string'">
<asp:TextBox id="{@Name}" runat="server"></asp:TextBox>
</xsl:if>
<xsl:if test="@DataType='unsignedInt'">
<asp:TextBox id="{@Name}" runat="server"></asp:TextBox>
</xsl:if>
</td>
<xsl:apply-templates/>
</tr>
</xsl:template>
but I can't figure out how to reference the child element (if present)
to set the value of the various controls.
Can this be done?