Subject: RE: [xsl] FW: key, generate-id, ignoring my template From: "Michael Kay" <mhk@xxxxxxxxx> Date: Mon, 22 Mar 2004 23:17:10 -0000 |
# It seems like this template match is not working: # <xsl:template match="/form/page/pcp"> It is working. What it does is <xsl:for-each select="$vBenePlan"> where vBenePlan is a global variable defined as <xsl:variable name="vBenePlan" select="/form/page/pcp/*[generate-id() = generate-id(key('kbeneplan', plan_desc)[1])]" /> There is nothing in the logic of this template rule that causes it to process only the node that was matched, instead it processes all the nodes in the node-set selected by this global variable. Michael Kay # # ===xml=== # <?xml version='1.0'?> # <form> # <page name='MEDICAL'> # <heading2> 2004 Medical Options for Wxxxx,Donald # x</heading2> # <pcp> # <row number='0'> # <plangroup>C</plangroup> # <benefit_plan>PBASIC</benefit_plan> # <plan_desc>PacifiCare / UA Net Basic</plan_desc> # <option_id>400</option_id> # <covrg_cd>1</covrg_cd> # <covrg_desc>Employee Only</covrg_desc> # <price>109.1</price> # <heading>CU Medical PLANS</heading> # <hlth_provider_reqd>R</hlth_provider_reqd> # <internal_external>I</internal_external> # <provider_link_cu>PACIFICARE</provider_link_cu> # <planType>10</planType> # <radio> # <name>pmedsel</name> # <value>400</value> # <text>Employee Only</text> # <checked>N</checked> # </radio> # <link> # <text>Click here to Lookup PCP</text> # # <address>javascript:launchInternal('PACIFICARE')</address> # </link> # </row> # <row number='1'> # <plangroup>C</plangroup> # <benefit_plan>PBASIC</benefit_plan> # <plan_desc>PacifiCare / UA Net Basic</plan_desc> # <option_id>401</option_id> # <covrg_cd>2</covrg_cd> # # <covrg_desc>Employee+Spouse/DomesticPartnr</covrg_desc> # <price>283.61</price> # <heading>CU Medical PLANS</heading> # <hlth_provider_reqd>R</hlth_provider_reqd> # <internal_external>I</internal_external> # <provider_link_cu>PACIFICARE</provider_link_cu> # <planType>10</planType> # <radio> # <name>pmedsel</name> # <value>401</value> # <text>Employee+Spouse/DomesticPartnr</text> # <checked>N</checked> # </radio> # <link> # <text>Click here to Lookup PCP</text> # # <address>javascript:launchInternal('PACIFICARE')</address> # </link> # </row> # <row number='2'> # <plangroup>C</plangroup> # <benefit_plan>PBASIC</benefit_plan> # <plan_desc>PacifiCare / UA Net Basic</plan_desc> # <option_id>402</option_id> # <covrg_cd>3</covrg_cd> # <covrg_desc>Employee + Child(ren)</covrg_desc> # <price>258.17</price> # <heading>CU Medical PLANS</heading> # <hlth_provider_reqd>R</hlth_provider_reqd> # <internal_external>I</internal_external> # <provider_link_cu>PACIFICARE</provider_link_cu> # <planType>10</planType> # <radio> # <name>pmedsel</name> # <value>402</value> # <text>Employee + Child(ren)</text> # <checked>N</checked> # </radio> # <link> # <text>Click here to Lookup PCP</text> # # <address>javascript:launchInternal('PACIFICARE')</address> # </link> # </row> # # # </pcp> # </page> # <page name='DENTAL'> # <heading2>2004 Dental Options for Wxxxx,Donald # x</heading2> # <pcp> # <row number='0'> # <plangroup>C</plangroup> # <benefit_plan>DEPO</benefit_plan> # <plan_desc>Delta Exclsv Pnl Optn</plan_desc> # <option_id>325</option_id> # <covrg_cd>1</covrg_cd> # <covrg_desc>Employee Only</covrg_desc> # <price>0</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>325</value> # <text>Employee Only</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='1'> # <plangroup>C</plangroup> # <benefit_plan>DEPO</benefit_plan> # <plan_desc>Delta Exclsv Pnl Optn</plan_desc> # <option_id>326</option_id> # <covrg_cd>2</covrg_cd> # # <covrg_desc>Employee+Spouse/DomesticPartnr</covrg_desc> # <price>13.5</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>326</value> # <text>Employee+Spouse/DomesticPartnr</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='2'> # <plangroup>C</plangroup> # <benefit_plan>DEPO</benefit_plan> # <plan_desc>Delta Exclsv Pnl Optn</plan_desc> # <option_id>327</option_id> # <covrg_cd>3</covrg_cd> # <covrg_desc>Employee + Child(ren)</covrg_desc> # <price>16.36</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>327</value> # <text>Employee + Child(ren)</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='3'> # <plangroup>C</plangroup> # <benefit_plan>DEPO</benefit_plan> # <plan_desc>Delta Exclsv Pnl Optn</plan_desc> # <option_id>328</option_id> # <covrg_cd>4</covrg_cd> # <covrg_desc>Family</covrg_desc> # <price>29.86</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>328</value> # <text>Family</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='4'> # <plangroup>C</plangroup> # <benefit_plan>DDPO</benefit_plan> # <plan_desc>Delta DPO Dental</plan_desc> # <option_id>321</option_id> # <covrg_cd>1</covrg_cd> # <covrg_desc>Employee Only</covrg_desc> # <price>17.23</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>321</value> # <text>Employee Only</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='5'> # <plangroup>C</plangroup> # <benefit_plan>DDPO</benefit_plan> # <plan_desc>Delta DPO Dental</plan_desc> # <option_id>322</option_id> # <covrg_cd>2</covrg_cd> # # <covrg_desc>Employee+Spouse/DomesticPartnr</covrg_desc> # <price>45.33</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>322</value> # <text>Employee+Spouse/DomesticPartnr</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='6'> # <plangroup>C</plangroup> # <benefit_plan>DDPO</benefit_plan> # <plan_desc>Delta DPO Dental</plan_desc> # <option_id>323</option_id> # <covrg_cd>3</covrg_cd> # <covrg_desc>Employee + Child(ren)</covrg_desc> # <price>51.71</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>323</value> # <text>Employee + Child(ren)</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # <row number='7'> # <plangroup>C</plangroup> # <benefit_plan>DDPO</benefit_plan> # <plan_desc>Delta DPO Dental</plan_desc> # <option_id>324</option_id> # <covrg_cd>4</covrg_cd> # <covrg_desc>Family</covrg_desc> # <price>79.81</price> # <heading>CU Dental PLANS</heading> # <hlth_provider_reqd>N</hlth_provider_reqd> # <internal_external> </internal_external> # <provider_link_cu> </provider_link_cu> # <planType>11</planType> # <radio> # <name>pdensel</name> # <value>324</value> # <text>Family</text> # <checked>N</checked> # </radio> # <link> # <text>Primary Care Provider Not Required</text> # <address></address> # </link> # </row> # </pcp> # </page> # </form> # ===xsl=== # <xsl:stylesheet # xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> # # <xsl:template match="/"> # <HTML xmlns:v="urn:schemas-microsoft-com:vml"> # <xsl:apply-templates /> # </HTML> # </xsl:template> # # <xsl:key name="kbeneplan" match="/form/page/pcp/row" # use="plan_desc" /> <xsl:variable name="vBenePlan" # select="/form/page/pcp/*[generate-id() = # generate-id(key('kbeneplan', plan_desc)[1])]" /> # # <xsl:key name="kheading" match="/form/page/pcp/row" # use="heading" /> <xsl:variable name="vheading" # select="/form/page/pcp/*[generate-id() = # generate-id(key('kheading', heading)[1])]" /> # # <xsl:template match="/form/page/pcp"> # # <table cellspacing="2" cellpadding="3" border="1" > # # <xsl:for-each select="$vBenePlan"> # <xsl:variable name="vCount" # select="count(/form/page/pcp//*[plan_desc = current() /plan_desc])" /> # # <xsl:if test="not(preceding-sibling::row[heading = current() # /heading][1])"> # <tr> # <td colspan="4"> # <b> <xsl:copy-of select="heading" /> </b> # </td> # </tr> # </xsl:if> # <tr> # <td> # <xsl:attribute name="rowspan"> # <xsl:value-of select="$vCount + 1" /> # </xsl:attribute> # <b> <xsl:copy-of select="plan_desc" /> </b> # </td> # </tr> # # <xsl:for-each select="key('kbeneplan', plan_desc)"> # <tr> # <td> # <xsl:value-of select="covrg_desc" /> # </td> # <td> # <xsl:value-of select="price" /> # </td> # <xsl:if test="not(preceding-sibling::row[plan_desc = # current() /plan_desc][1])"> # <td> # <xsl:attribute name="rowspan"> # <xsl:value-of select="$vCount + 1" /> # </xsl:attribute> # <xsl:element name="a"> # <xsl:attribute name="href"> # <xsl:copy-of select="address"/> # </xsl:attribute> # <xsl:copy-of select="link/text"/> # </xsl:element> # </td> # </xsl:if> # </tr> # </xsl:for-each> # # </xsl:for-each> # </table> # </xsl:template> # # # <xsl:template match="Bigger"> # <FONT size="+2"> # <xsl:value-of select="."/> # </FONT> # </xsl:template> # # <xsl:template match="heading2"> # <b><FONT size="+2"> # <xsl:value-of select="."/> # </FONT></b> # </xsl:template> # </xsl:stylesheet> # #
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] FW: key, generate-id, ign, Andreas L. Delmelle | Thread | RE: [xsl] FW: key, generate-id, ign, Laura Madonna |
RE: [xsl] FW: key, generate-id, ign, Andreas L. Delmelle | Date | RE: [xsl] FW: key, generate-id, ign, Laura Madonna |
Month |