|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: FW: Basic XSLT ;-)
Hi Robert,
As David mentions, I'm afraid the combination of normalize-space and text gives only the normalized value of the _first_ text node in <foo>. I'm not sure that is the problem you are dealing with, but it could. And if it does, the code below might help. Trouble is with XSLT 1 that all useful functions (like normalize and contains) only take the first node out of a node-set argument. So you need to get a single node with all the content you want to take into account. You could try doing:
<xsl:template match="foo">
<xsl:variable name="value">
<xsl:copy-of select="text()" />
</xsl:variable> <xsl:if test="contains($value, 'Value')">
...
</xsl:if>
</xsl:template>in which the text nodes should be merged into a single text node (in a fragment tree actually). To make it a bit more complex, you could retrieve the value with apply-templates as well, which makes it possible to include/exclude specific elements in the content: <xsl:template match="foo">
<xsl:variable name="value">
<xsl:apply-templates select="node()" mode="filter-value" />
</xsl:variable> <xsl:if test="contains($value, 'Value')">
...
</xsl:if>
</xsl:template><xsl:template match="*" mode="get-value">
<xsl:if test="self::bar">
<xsl:apply-templates select="node()" mode="get-value" />
</xsl:if>
</xsl:template>On the other hand, it could just be that your 'Value' is not tested with the correct CaSe. a translate($value, 'ABC..', 'abc..') might help in that case.. Hope this helps... Cheers Robert Soesemann wrote: I am struggeling with a really basic XSL task. I guess I am missin something. I need a template that matches the text values of all foo element whose original value is 'Value'. The original value should be normalized as I want to match e.g.:
http://www.daidalos.nl/ tel:+31-(0)79-3316961 fax:+31-(0)79-3316464 GPG: 1024D/12DEBB50
|
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
|

Cart








