Subject: [xsl] Writing array elements based on a an evaluation of one of the child elements From: neil cave <coraltrees@xxxxxxxxxxx> Date: Wed, 24 May 2006 11:10:43 +0100 (BST) |
Hi there I'm trying to write some XSL that ommits a bunch of Null and Zero array elements from the XML. In my XSLT, when I see the ACCOUNT-LIST element I want to write a parent element called ACCOUNT-LIST . Then I want to write out the child-elements of ACCOUNT-LIST and their values only if the string-length in the current occurence of ACCOUNT-NO is greater than 0. So I try using an xsl:choose and xsl:when as follows... <xsl:template match = "ACCOUNT_LIST"> <xsl:element name = "ACCOUNT-LIST"> <xsl:choose> <xsl:when test="count(//ACCOUNT-NO[string-length(.) > 0])"> <xsl:element name = "ACCOUNT-NO"> <xsl:value-of select="."/> </xsl:element> <xsl:element name = "SBU-CODE"> <xsl:value-of select = "."/> </xsl:element> <xsl:element name = "RISK_TYPE"> <xsl:value-of select = "."/> </xsl:element> </xsl:when> </xsl:choose> </xsl:element> </xsl:template> But it writes out all the data without creating tags - what am I doing wrong here? Regards Neil
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Absolute/relative positio, Hood, Earl | Thread | RE: [xsl] Writing array elements ba, Florent Georges |
Re: [xsl] Passing variables into XS, David Carlisle | Date | Re: [xsl] How to retrieve global pa, Abel Braaksma Online |
Month |