Mike Conmackie (Thu, 29 Apr 2004 19:11:21 -0400):
Yes, it could look like that. There can be from 1 to n <hostid> tags and
the value of the "type" attribute can be any one of a fixed set of 4 values
{ethernet, serial, softkey, internet}. Hope this helps.
Ok. I tried the following templates:
<xsl:template match="feature">
<xsl:element name="key">
<xsl:attribute name="protected" />
<xsl:apply-templates select="name|version|start|expires|count"/>
<xsl:call-template name="hostids"/>
</xsl:element>
</xsl:template>
<xsl:template name="hostids">
<xsl:if test="hostid[@type='ethernet']">
<hostid>
<xsl:apply-templates select="hostid[@type='ethernet']">
<xsl:with-param name="element">Eth</xsl:with-param>
</xsl:apply-templates>
</hostid>
</xsl:if>
<xsl:if test="hostid[@type='serial']">
<hostid>
<xsl:apply-templates select="hostid[@type='serial']">
<xsl:with-param name="element">Serial</xsl:with-param>
</xsl:apply-templates>
</hostid>
</xsl:if>
<xsl:if test="hostid[@type='softkey']">
<hostid>
<xsl:apply-templates select="hostid[@type='softkey']">
<xsl:with-param name="element">Softkey_id</xsl:with-param>
</xsl:apply-templates>
</hostid>
</xsl:if>
</xsl:template>
<xsl:template match="hostid">
<xsl
aram name="element"/>
<xsl:element name="{$element}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
Its not really nice. Esp. the 3 rather similar if-s.
Regards
Chris
PS: I'll mail you the complete template back.