Subject: Re: [xsl] Re: for-each not working From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 14 Jul 2003 23:46:58 +0100 |
> > How do i compare the contents of a tag to an empty string? Be careful not to use "tag" when you mean element. The content of a start tag just consists of the element name attribute names and values and some ignored whitespace. The content of an end tag is just an element name and ignored white space. XSLT does not give direct access to the contents of the tag at all. An element node is created which will have attributes corresponding to the attribute markup in the start tag, but not directly to the tag contents itself (unlike some other processing languages, which do give access to this data). > I thought i could > invoke this call and be able to process the contents of each > <restrictedValue> tag separately. But that is not the case. A "for-each > snippet" works for me but i am not able to put "Min Value Allowed: 40" like > this or "Max Value Allowed: None". They both have to placed before the > "for-each" statement. Below you will find how i want the output to be > displayed. This is how i was tryin to solve this problem: > > XSL (faulty): > > Once inside the template: > > Min Value Allowed: <br /> > Max Value Allowe: <br /> > <xsl:when test="contains(@restrictType, '2')"> > <xsl:for-each select="restrictedValue"> > <xsl:value-of select="text()" /><br/> > </xsl:for-each><br /><br /> > </xsl:when> > > But this doesn't solve my problem This forms a "template" of the result you got. (not the result you wanted) isn't it clear that if you do the above you will get the two lines of text before any of the values? I think you just want Min Value Allowed: <xsl:apply-templates select="restrictedValue[1]"/><br /> Max Value Allowed: <xsl:apply-templates select="restrictedValue[2]"/><br /> together with a template <xsl:template match="restrictedValue[.='']">None</xsl:template> David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: for-each not working, John Liebermann | Thread | Re: [xsl] Re: for-each not working, Mukul Gandhi |
[xsl] Precompiling Xpath expression, Joseph Kesselman | Date | [xsl] Re: paths not working..., John Liebermann |
Month |