[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: finding whether starts-with or not prob
Jarkko.Moilanen@xxxxxx wrote:
I have a small prob. I'm trying to apply a template inside another one. The tempalte is supposed to solve whether the <DocType> value is order or something else and depending from the result do something in both cases. I have been trying to solve whats wrong, but I can't find the reason why it is not working. I know this is not the best solution for this case, to find out the content of the element, but hey... who's perfect =)This end tag is probably a typo, isn't it? Get rid of this and the stylesheet will work. <xsl:if test="@SignStatus='Open'">More correctly, *the context node* is an "Information" element. And this end tag doesn't have counterpart start tag, which <xsl:if> do you want to close here?<xsl:apply-templates select="DocType" /> <td bgcolor="#C4DAFE" width="124"> <p ID="Sender"><font size="-2"> <xsl:value-of select="Sender" /></font> </p></td> </xsl:if> </xsl:template>Not exactly. "." is a short form of self::node(), which means the context node itself, which is DocType element in the place and <xsl:value-of> instruction is outputting string value of the first node selected by expression in "select" attribute, so you can say <xsl:value-of select="." /> is outputting string value of the context node. </p></td> </xsl:if> <xsl:if test="starts-with(., 'order')"> <td bgcolor="#C4DAFE" width="50"> <p ID="type"><font size="-2"><b> <xsl:value-of select="." /></b></font> </p></td> </xsl:if> </xsl:template> btw, isn't it simpler to use a choice here? <xsl:template match="DocType"> <td bgcolor="#C4DAFE" width="50"> <p ID="type"> <font size="-2"> <xsl:choose> <xsl:when test="starts-with(., 'order')"> <b> <xsl:value-of select="."/> </b> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </font> </p> </td> </xsl:template> -- Oleg Tkachenko Multiconn International, Israel 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
|