Re: tough XSLT problem



Bloody Viking wrote:

> Pardon me. My example wasn't clear. A contains any number of elements,
> which may be named with any letter, and it may contain multiple
> instances of an element named X (X may contain any text). So, one
> element A may have:
> <A><B/><C>C-text</C><X>X-text</X><D/><E/><X>X-text</X></A>
>
> another instance of A may be:
>
> <A><B/><C>C-text</C><D/><E/><X>X-text</X></A>

OK, gottit, thanks.

> The variable created must have the text of element C. If the element
> immediately following C is named X (as in the first example), the
> variable should then have a space followed by the text in X:
>
> C-text X-text

OK, then my first example will do (adding the space):

<xsl:template match="A">
<xsl:variable name="someText">
<xsl:value-of select="C">
<xsl:text> </xsl:text>
<xsl:if test="name(C/following-sibling::*[1])='X'">
<xsl:value-of select="D"/>
</xsl:if>
</xsl:variable>
<!-- more XSLT here -->
</xsl:template>

///Peter

.



Relevant Pages