Altova Mailing List Archives


=?windows-1256?Q?Re=3A_=5Bxsl=5D_Total_Missing_documents?=

From: David Carlisle <davidc@---.--.-->
To: xsl-list@-----.------------.---
Date: 4/9/2010 12:34:00 AM
On 08/04/2010 19:27, Shashank Jain wrote:
>
> Hello All,
>
> I am trying to create the list of missing documents and their count for each event.
>
> <data>
> <event_template sp_mand_doctypes="PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS, Final Client Models">
> <event>
>      <document_type sp_document_type="Final Client Models"/>
> </event>
> <event>
>      <document_type sp_document_type="Final Client Models"/>
>      <document_type sp_document_type="Rationale"/>
> </event>
> <event>
>      <document_type sp_document_type="Analyst"/>
> </event>
> <event_template>
> </data>
>
> So my table should look like
>
> For 1st Event list of missing documents will be [PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS] and count is 5
> For 2nd Event list of missing documents will be [PSC Minutes, Internal Approval, Trade Instructions, IPS] and count is 4
> For 3rd Event list of missing documents will be [PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS, Final Client Models] and count is 6. "Analyst" is not the mandatory document as it is not present in the sp_mand_doctype list.
>
> I am using this following code.
>
> <xsl:for-each select="event">
>      <xsl:call-template name =" DocsMissing "/>
> </xsl:for-each>
>
> <xsl:template name="DocsMissing">
>          <xsl:choose>
>                  <xsl:variable name="mandatoryDocs" select="parent::node()/@sp_mand_doctypes"/>
....
           </xsl:if>
 >      </xsl:template>
 >
 > With this I am able to right number of Missing Docs f

It's a syntax error to have an xsl:variable at this point, so i wouldn't 
have expected this to run at all?
I think you just want

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match="event_template">
<xsl:variable name="x"
	      select="tokenize(@sp_mand_doctypes,'\s*,\s*')"/>
<xsl:for-each select="event">
For event <xsl:value-of select="position()"/>
<xsl:text> list is </xsl:text>
<xsl:value-of select="$x[not(.=current()/document_type/@sp_document_type)]"
	      separator=","/>
<xsl:text> count </xsl:text>
<xsl:value-of 
select="count($x[not(.=current()/document_type/@sp_document_type)])"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--

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.