xsl-list
[Top] [All Lists]

Re: [xsl] Total Missing documents for each Event‏

2010-04-08 19:34:09
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--