[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How do I check if an element exists with the same name
Dear XSL(T) users, After checking most of the XSL-list archives and reading nearly the whole XSL companion by Neil Bradley I fear the thing I want is not possible with 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, Tim Ps. Poster information: Vendor: Microsoft Processor version: Original IE5 (or old version of other processor) XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|