Subject: Re: how to use normalize-space From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 9 Dec 1999 14:19:21 GMT |
<xsl:template match="p[list]"> <List> <xsl:if test="normalize-space(list[listitem='Related topics'])"> <ListTitle><xsl:value-of select="list/listitem"/></ListTitle> </xsl:if> <xsl:for-each select="list/listitem"><!-- if it's value is not 'Related topics' --> <ListItem><xsl:apply-templates/></ListItem> </xsl:for-each> </List> </xsl:template> "normalize-space(list[listitem='Related topics'])" would select the list nodes with listitemm child equal to (exactly) 'Related topics' Then take the string value of that list, and normalise it's white space. As it's used in a boolean context, thi swill be true if its non empty. Probably what you want to do is select the list elements with listitem elements with normalised value 'Related topics' which is "list[normalize-space(listitem)='Related topics']" The comment if it's value is not 'Related topics' above is false. That is not an else-clause to the if, it is just the following expression so it will always be evaluated. To get the effect of an `else' you want to use xsl:choose not xsl:if. then you can use xsl:otherwise. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
how to use normalize-space, Linda van den Brink | Thread | Selection based on attribute value, Brett McLaughlin |
how to use normalize-space, Linda van den Brink | Date | Re: Escaping within an xsl:attribut, David Carlisle |
Month |