Subject: RE: [xsl] Total Missing documents for each Event From: Shashank Jain <shashankjain@xxxxxxxx> Date: Mon, 26 Apr 2010 13:03:05 -0500 |
Got it.. In the function I should have done <xsl:sequence select="count($x[not(.=$event/document_type/@sp_document_type)])"/> I was not matching my context with the current event. Thanks for looking... Shashank ---------------------------------------- > From: shashankjain@xxxxxxxx > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > CC: davidc@xxxxxxxxx > Date: Mon, 26 Apr 2010 12:01:58 -0500 > Subject: RE: [xsl] Total Missing documents for each Event~ > > > (Sending it again, removed the extra spaces in the code) > Hello All, > > I am trying to calculate the Sum of total Missing Docs. > Here is my XML: > > > > > > > > > > > > > > > > > > > > > > > > > > Previously I used following template to calculate number of missing > events, thanks to David for that. > > > > > > > > > > -- > > > > select="tokenize(parent::node()/@sp_mand_doctypes,'\s*,\s*')"/> > > select="count($x[not(.=current()/document_type/@sp_document_type)])"/> > > > > > I got the required output 5,4,6,3,2. > > Now I am trying to add all those values and for that I am using this > function, so I want the total to be 5+4+6+3+2=20 > > > > > > > > > select="tokenize($event/../@sp_mand_doctypes,'\s*,\s*')"/> > > select="count($x[not($event/document_type/@sp_document_type)])"/> > > > > > And calling this function in this way > > > I am not able to get the desired output. Looks like Function is not > calculating the value at each event properly. Please correct me where > I am doing it wrong. > > Thanks > Shashank > ---------------------------------------- >> From: shashankjain@xxxxxxxx >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >> CC: davidc@xxxxxxxxx >> Date: Mon, 26 Apr 2010 11:51:19 -0500 >> Subject: RE: [xsl] Total Missing documents for each Event~ >> >> >> >> >> >> >> Hello All, >> >> >> >> I am trying to calculate the Sum of total Missing Docs. >> >> Here is my XML: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Previously I used following template to calculate number >> of missing events, thanks to David for that. >> >> >> >> >> select="event"> >> >> >> name="NumDocumentsMissing"/> >> >> >> >> >> >> >> >> >> >> >> >> >> test="@complete='Y'"> >> >> -- >> >> >> >> >> >> >> name="x" >> select="tokenize(parent::node()/@sp_mand_doctypes,'\s*,\s*')"/> >> >> >> select="count($x[not(.=current()/document_type/@sp_document_type)])"/> >> >> >> >> >> >> >> >> >> >> I got the required output 5,4,6,3,2. >> >> >> >> Now I am trying to add all those values and for that I am >> using this function, so I want the total to be 5+4+6+3+2=20 >> >> >> >> >> name="event" as="element()"/> >> >> >> >> >> test="$event/@complete='Y'"> >> >> >> select="0"/> >> >> >> >> >> >> >> select="tokenize($event/../@sp_mand_doctypes,'\s*,\s*')"/> >> >> >> select="count($x[not($event/document_type/@sp_document_type)])"/> >> >> >> >> >> >> >> >> >> >> And calling this function in this way >> >> >> >> >> >> I am not able to get the desired output. Looks like >> Function is not calculating the value at each event properly. Please correct me >> where I am doing it wrong. >> >> >> >> Thanks >> >> Shashank >> >> >> >> >> >>> From: shashankjain@xxxxxxxx >>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >>> CC: davidc@xxxxxxxxx >>> Date: Fri, 9 Apr 2010 11:35:27 -0500 >>> Subject: RE: [xsl] Total Missing documents for each Event~ >>> >>> >>> Thanks David ! >>> >>> You understood my requirement very well, this is exactly what I wanted. >>> I agree my code is vastly complicated , I will work on it to write more efficient code. >>> >>> Thanks again. >>> >>> Shashank >>> >>> ---------------------------------------- >>>> Date: Fri, 9 Apr 2010 17:00:02 +0100 >>>> From: davidc@xxxxxxxxx >>>> To: shashankjain@xxxxxxxx >>>> CC: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >>>> Subject: Re: [xsl] Total Missing documents for each Event~ >>>> >>>> Either I'm not understanding your requirements or your code is vastly >>>> more complicated than needed (or both) >>>> >>>> i think you just want >>>> >>>> >>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >>>> >>>> >>>> >>>> >>>> select="tokenize(@sp_mand_doctypes,'\s*,\s*')"/> >>>> >>>> For event >>>> list is: >>>> select="$x[not(.=current()/document_type/@sp_document_type)]" >>>> separator=","/> >>>> count >>>> >>>> select="count($x[not(.=current()/document_type/@sp_document_type)])"/> >>>> additional docs: >>>> select="document_type/@sp_document_type[not(.=$x)]" >>>> separator=","/> >>>> count >>>> >>>> >>>> >>>> >>>> >>>> >>>> which makes >>>> >>>> >>>> $ saxon9 list.xml list.xsl >>>> >>>> >>>> For event 1 >>>> list is: PSC Minutes,Internal Approval,Rationale,Trade >>>> Instructions,IPS count 5 >>>> additional docs: count 0 >>>> For event 2 >>>> list is: PSC Minutes,Internal Approval,Trade Instructions,IPS count 4 >>>> additional docs: count 0 >>>> For event 3 >>>> list is: PSC Minutes,Internal Approval,Rationale,Trade >>>> Instructions,IPS,Final Client Models count 6 >>>> additional docs: Analyst count 1 >>>> >>>> >>>> >>>> >>>> >>>> ________________________________________________________________________ >>>> The Numerical Algorithms Group Ltd is a company registered in England >>>> and Wales with company number 1249803. The registered office is: >>>> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. >>>> >>>> This e-mail has been scanned for all viruses by Star. The service is >>>> powered by MessageLabs. >>>> ________________________________________________________________________ >>>> >>> >>> _________________________________________________________________ >>> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. >>> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4 >>> >> >> _________________________________________________________________ >> The New Busy is not the old busy. Search, chat and e-mail from your inbox. >> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 >> > > _________________________________________________________________ > The New Busy is not the old busy. Search, chat and e-mail from your inbox. > http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 > _________________________________________________________________ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Total Missing documents f, Shashank Jain | Thread | [xsl] Nodes get new IDs in function, Martynas Jusevicius |
RE: [xsl] Total Missing documents f, Shashank Jain | Date | [xsl] Rusty at XSLT, need help ("Oi, cknell |
Month |