Subject: Re: [xsl] Disjunctive reasoning in XSLT: controlling presence of subtrees From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 20 Apr 2007 20:29:46 +0100 |
This works fine. The difficulty arises from the fact that the input data (a given row) can be quite variable: An auto policy might have one driver, or five, might cover one vehicle or 7, there might be no prior accidents or violations, or several, etc., etc. The naive transform that I currently generate takes an expansive approach, setting up XML subtrees for most everything that might possibly be coming through in the data. This has the effect of leaving essentially empty subtrees throughout the target ACORD tree, which is not acceptable. I currently perform a post-process tree walk to clean up. However, I'd like to understand if it is possible to more intelligently generate an XSLT transform which can omit various subtrees when the data for them is not present.
<xsl:template match="colname"> <xsl:variable name="children" as="element()*"> <!-- Code for generating the children goes here --> </xsl:variable> <xsl:if test="exists($children)"> <newElement> <xsl:sequence select="$children" /> </newElement> </xsl:if> </xsl:template>
Jeni -- Jeni Tennison http://www.jenitennison.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Disjunctive reasoning in , Andrew Welch | Thread | RE: [xsl] Disjunctive reasoning in , Michael Kay |
Re: [xsl] Disjunctive reasoning in , Andrew Welch | Date | [xsl] using xsl:message with UTF-8 , Manfred Staudinger |
Month |