Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Fine Tuning of xsl

From: "Dimitre Novatchev [MVP XML]" <dnovatchev@-----.--->
To: NULL
Date: 3/3/2004 9:42:00 PM
Have empty rules for all elements you don't want processed a second time.

Define moded templates to do the special processing of these elements. Issue
an xsl:apply-templates instruction to process these elements with the
attribute "mode" set to the mode, specified on the template rules.

If this explanation makes little sense, then you must read about "modes" in
XSLT.


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


"Faith Cosgrove-Naftal" <faith.cosgrovenaftal@c...> wrote in
message news:%23GkETkVAEHA.3456@T......
> Hi again.  I am working with the same "dynamic" xsl I came up with (with
> lots of help) a month or so ago, but need a twist that I just can't get
> to work.
>
> The xsl is as follows:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format">
>
>
> <xsl:template match="/">
>
> <style type="text/css">
> h3 {color:#000000;  background-color:#0066CC}
> .BM {font-weight: bold;}
>
>
> .tableclass{ font-family: sans-serif; width:100%;}
> .tableclass1{ font-family: sans-serif; font-size:17px;
> Background-color:teal; width:100%;}
> .tableclass2{ font-family: sans-serif; font-size:16px;
> Background-color:lightgreen; width:100%; }
> .tableclass3{ font-family: sans-serif; font-size:15px;
> Background-color:pink; width:100%; }
> .tableclass4{ font-family: sans-serif; font-size:14px;
> Background-color:pink; width:100%; }
> .tableclass5{ font-family: sans-serif; font-size:12px;
> Background-color:pink; width:100%;}
> </style>
>
> <table class="tableclass">
>
>        <xsl:apply-templates select="*"/>
> </table>
>
>   </xsl:template>
>
>
>  <xsl:template match="*">
>   <xsl:variable name="count" select="count(ancestor::*)"/>
>     <tr>
>
> <xsl:choose >
>
> <xsl:when test="name()='VerifierResultsInfo'">
> <td width="250px">
>       </td>
>       <td width ="500px">
>       </td>
> </xsl:when>
> <xsl:when test="name()='InteractiveResultsInfo'">
> <td width="250px">
>       </td>
>       <td width ="500px">
>       </td>
> </xsl:when>
> <xsl:when test="name()='CompareResultsInfo'">
> <td width="250px">
>       </td>
>       <td width ="500px">
>       </td>
> </xsl:when>
>
> <xsl:otherwise >
> <xsl:variable name="indentAmt" select ="250-($count*10)"/>
> <td width="30%" style="padding-left:{($count * 10) }">
>
> <xsl:value-of select="name()"/>
>       </td>
>       <td width="70%" align="left">
> <xsl:choose>
> <xsl:when test="normalize-space(text())=''"><xsl:text
> disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:when>
> <xsl:otherwise><xsl:value-of select="text()"/></xsl:otherwise>
> </xsl:choose>
>       </td>
>
> </xsl:otherwise>
> </xsl:choose>
>       <xsl:if test="*">
>        <tr>
>
>          <td  colspan="2">
> <xsl:choose >
> <xsl:when test="$count=3">
> <table class="tableclass4" cellspacing ="0" cellpadding="0">
>             <xsl:apply-templates select="*"/>
>            </table>
> </xsl:when>
> <xsl:when test="$count=2">
> <table class="tableclass3" cellspacing ="0" cellpadding="0">
>             <xsl:apply-templates select="*"/>
>            </table>
> </xsl:when>
> <xsl:when test="$count=1">
> <table class="tableclass2" cellspacing ="0" cellpadding="0">
>             <xsl:apply-templates select="*"/>
>            </table>
> </xsl:when>
> <xsl:when test="$count=0">
> <table class="tableclass1" cellspacing ="0" cellpadding="0">
>             <xsl:apply-templates select="*"/>
>            </table>
> </xsl:when>
> <xsl:otherwise >
> <table class="tableclass5" cellspacing ="0" cellpadding="0">
>             <xsl:apply-templates select="*"/>
>            </table>
> </xsl:otherwise>
> </xsl:choose>
>
>          </td>
>
>        </tr>
>     </xsl:if>
>     </tr>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> Here's some sample xml:
>
> <FraudResultsInqRs>
> <Status>
> <StatusCode>0</StatusCode>
> <Severity>Info</Severity>
> <StatusDesc>The request was processed successfully.</StatusDesc>
> </Status>
> <RqUID>00375403-0200-8264-5353-101138243891</RqUID>
> <CompareResultsInfo>
> <CustId>
> <SPName>FiservSTAR</SPName>
> <CustPermId>STAR3375</CustPermId>
> </CustId>
> <FraudCode>None</FraudCode>
> <DecisionReasonInfo>
> <DecisionReasonCode>00</DecisionReasonCode>
> <DecisionReasonDesc>Invalid Message</DecisionReasonDesc>
> </DecisionReasonInfo>
> <CompareInfo>
> <PersonName>
> <LastName>TESTLASTAI</LastName>
> <FirstName>MICKEY</FirstName>
> <MiddleName>DANIEL</MiddleName>
> <TitlePrefix/>
> <NameSuffix/>
> <BusinessName/>
> </PersonName>
> <CustAddr>
> <HouseNum/>
> <Street>RT 200</Street>
> <ApartmentNum/>
> <City>TOLEDO</City>
> <StateProv>OH</StateProv>
> <ZipCode>43611</ZipCode>
> <PostalCode/>
> <Country/>
> <AddrCode>PRIMARY</AddrCode>
> </CustAddr>
> <CustAddr>
> <HouseNum>1452</HouseNum>
> <Street>Hollywood</Street>
> <ApartmentNum/>
> <City>Beverly Hills</City>
> <StateProv>CA</StateProv>
> <ZipCode>90210</ZipCode>
> <PostalCode/>
> <Country/>
> <AddrCode>PREVIOUS</AddrCode>
> </CustAddr>
> <CustAddr>
> <HouseNum>1355</HouseNum>
> <Street>Caroll</Street>
> <ApartmentNum>5A</ApartmentNum>
> <City>Kissimmee</City>
> <StateProv>FL</StateProv>
> <ZipCode>34741</ZipCode>
> <PostalCode/>
> <Country/>
> <AddrCode>PREVIOUS</AddrCode>
> </CustAddr>
> <CustAddr>
> <HouseNum>7352</HouseNum>
> <Street>46A</Street>
> <ApartmentNum/>
> <City>Lake Mary</City>
> <StateProv>FL</StateProv>
> <ZipCode>32746</ZipCode>
> <PostalCode/>
> <Country/>
> <AddrCode>PREVIOUS</AddrCode>
> </CustAddr>
> <PrimaryAddrDuration/>
> <HasDriversLicenseFlag/>
> <IdAddrCode/>
> <PhoneNum>
> <PhoneType>EvePhone</PhoneType>
> <Phone>419-476-0123</Phone>
> </PhoneNum>
> <TaxId>580-18-9999</TaxId>
> <BirthDt>
> <Year>1951</Year>
> <Month>2</Month>
> <Day>1</Day>
> </BirthDt>
> <CustIdType>
> <SeqId>1</SeqId>
> <IdType>DL</IdType>
> <IdNum>BCCD4738-5516-457A</IdNum>
> <IdIssuer>FL</IdIssuer>
> <IdExpireDt>
> <Year/>
> <Month/>
> <Day/>
> </IdExpireDt>
> </CustIdType>
> </CompareInfo>
>
> </CompareResultsInfo>
> <CompareResultsInfo>
> <CustId>
> <SPName>FiservSTAR</SPName>
> <CustPermId>STAR3376</CustPermId>
> </CustId>
> <FraudCode>None</FraudCode>
> <DecisionReasonInfo>
> <DecisionReasonCode>00</DecisionReasonCode>
> <DecisionReasonDesc>Invalid Message</DecisionReasonDesc>
> </DecisionReasonInfo>
> <CompareInfo>
> <PersonName>
> <LastName>TESTLASTAJ</LastName>
> <FirstName>KIMBERLY</FirstName>
> <MiddleName>AMBER</MiddleName>
> <TitlePrefix/>
> <NameSuffix/>
> <BusinessName/>
> </PersonName>
> <CustAddr>
> <HouseNum/>
> <Street>P.O.BOX 987</Street>
> <ApartmentNum/>
> <City>N LITTLE ROCK</City>
> <StateProv>AK</StateProv>
> <ZipCode>72114</ZipCode>
> <PostalCode/>
> <Country/>
> <AddrCode>PRIMARY</AddrCode>
> </CustAddr>
> <PrimaryAddrDuration/>
> <HasDriversLicenseFlag/>
> <IdAddrCode/>
> <PhoneNum>
> <PhoneType>EvePhone</PhoneType>
> <Phone>1+501-2211122</Phone>
> </PhoneNum>
> <TaxId>580-28-9999</TaxId>
> <BirthDt>
> <Year>1951</Year>
> <Month>3</Month>
> <Day>6</Day>
> </BirthDt>
> <CustIdType>
> <SeqId>1</SeqId>
> <IdType>DL</IdType>
> <IdNum>H4501617131802</IdNum>
> <IdIssuer>WI</IdIssuer>
> <IdExpireDt>
> <Year/>
> <Month/>
> <Day/>
> </IdExpireDt>
> </CustIdType>
> </CompareInfo>
> </CompareResultsInfo>
> </FraudResultsInqRs>
>
> What I want to do is output the values of
> CompareInfo/PersonName/LastName, FirstName, and MiddleName at the top of
> the table with the h3 class, and then all the rest of the nodes.
> However, I don't want those values to be output when going the all of
> the nodes path...only output at the top.  Does this make sense?  Doable?
>
> Thanks...
>
> Faith Cosgrove-Naftal
> faith.cosgrovenaftal@c...
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent