After reading nearly the whole XSL companion by Neil Bradley I fear the
thing I want is not possible with XML/XSL, but just to be sure I'd like to
hear your opinion on it. Consider the following XML part:
<missing-inputfields>
<missing-field name='loginName'/>
</missing-inputfields>
<input-form caption="Submit">
<input-field name='loginName' caption='Name'/>
<input-field name='loginPWD' caption='Password' encrypted='true'/>
</input-form>
I'd like to convert this XML to HTML using an XLST. And here comes the
tricky part, I'd like to let the 'input-field' template check if there's a
'missing-field' with the same name. Is this possible and if so, how?
I tried things like:
<xsl:template match="input-field">
<tr>
<td width=150>
<xsl:value-of select="@caption"/>
<xsl:apply-templates select="//missing-field[@name={name}]">
<xsl:param name="nm">
<xsl:value-of select="@name"/>
</xsl:param>
</xsl:apply-templates>
</td>
<td>
<input type="text" size="20">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
</input>
</td>
</tr>
</xsl:template>
<xsl:template match="input-field">
<tr>
<td width=150>
<xsl:value-of select="@caption"/>
<xsl:if test="//missing-field[@name]={name}">
<img src="./mark.gif>
</xsl:if>
</td>
<td>
<input type="text" size="20">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
</input>
</td>
</tr>
</xsl:template>
But as you all might have guessed/known, this did not work. So that's why
I'm asking you if you can help me out. Is it possible, or not? Or do you
have no clue at what I'm trying to do? I'd appreciate any
help/comments/ideas because I'm rather stuck.
Yours sincerely,
Arvhatte
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<xsl:apply-templates select="/root/input-form/input-field" />
</xsl:template>
<xsl:template match="input-field">
<tr>
<td width="150">
<xsl:value-of select="@caption"/>
<xsl:apply-templates
select="/root/missing-inputfields/missing-field[@name = current()/@name]" />
</td>
<td>
<input type="text" size="20">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
</input>
</td>
</tr>
</xsl:template>
<xsl:template match="missing-field">
Missing
</xsl:template>
</xsl:transform>
Regards,
Gennady
"Arvhatte" <arvh...@lpmud.com> wrote in message
news:99ms6c$4kt$1...@news1.xs4all.nl...