Subject: RE: [xsl] Disjunctive reasoning in XSLT: controlling presence of subtrees From: "Kenneth Bowen" <kbowen@xxxxxxxxxxxxxx> Date: Mon, 23 Apr 2007 12:31:36 -0400 |
Jeni & Mike-- thanks! I think I'll be able to work it out now. A. I didn't realize I could make use of variables/exist the way Jeni suggests. I think I'll be able to put that to work to get what I need. B. I was a little hesitant to clutter the list with the code I'm synthesizing, but its seems clear from Mike's post that it would have helped. So as briefly as possible: Focusing on the fragmentary mappings I included in the original message, the main stylesheet created by my Java code looks something like this (all this code is generated including the subsidiary templates which are called): <xsl:template match="/"> <ACORD> .... <InsuranceSvcRq> ... <PersAutoPolicyQuoteInqRq> ... <PersAutoLineBusiness> ... <xsl:call-template name="PersDriver_template"> <xsl:with-param name="param-driverref"> <xsl:value-of select="$driver-1-Ident"/> </xsl:with-param> <xsl:with-param name="param0"> <xsl:call-template name="dr1_fname_template"/> </xsl:with-param> <xsl:with-param name="param1"> <xsl:call-template name="dr1_middle_template"/> </xsl:with-param> <xsl:with-param name="param2"> <xsl:call-template name="dr1_lname_template"/> </xsl:with-param> .....more params...15 in all...... </xsl:call-template> .......repetitions of this call-template for driver-2/3/4/5/6..... .... </xsl:template> Here's the beginning of the PersDriver_template which is called above: <xsl:template name="PersDriver_template"> <xsl:param name="param-driverref"/> <xsl:param name="param0"/> <xsl:param name="param1"/> <xsl:param name="param2"/> ..... <xsl:param name="param15"/> <PersDriver id="{$param-driverref}" > <GeneralPartyInfo> <NameInfo> <PersonName> <Surname><xsl:value-of select="$param2"/></Surname> <GivenName><xsl:value-of select="$param0"/></GivenName> <OtherGivenName><xsl:value-of select="$param1"/></OtherGivenName> </PersonName> <TaxIdentity> <TaxId><xsl:value-of select="$param3"/></TaxId> </TaxIdentity> ..... </xsl:template> Finally, here's dr1_fname_template (dr1_fname is one of the spreadsheet column headers): <xsl:template name="dr1_fname_template" match="/rawinput/dr1_fname"> <xsl:value-of select="/rawinput/dr1_fname"/> </xsl:template> The input data for this is: <rawinput> ... <dr1_fname>SALLY</dr1_fname> ... </rawinput> As you can see from ".......repetitions of this call-template for driver-2/3/4/5/6.....", The complete template which is built potentially has 6 subtrees for up to 6 drivers, yet in many policies to which it will be applied, there are typically only 1-2 drivers, so there's lots of subtree real estate which has to be ripped out at the end. Note also that this is only one of many such instances of this difficulty. It looks like Jeni's suggestion will give me a handle on this. I'm going to look for the smallest setting in which I can apply it first, and then grow it. I'll let you know how it goes. Many thanks again! Ken
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] tag and attribute statist, Michael Kay | Thread | [xsl] Subsets, Robert C Corsaro |
RE: [xsl] tag and attribute statist, Michael Kay | Date | Re: [xsl] XSLT Text Processing: Fun, Rashmi Rubdi |
Month |