RE: [xsl] Update Variables...

Subject: RE: [xsl] Update Variables...
From: cknell@xxxxxxxxxx
Date: Mon, 14 Apr 2003 16:51:59 -0500
> -----Original Message-----
> From:     "McCown, Sean" <Sean.McCown@xxxxxxxxxxxxxxx>
> 
> 
> Im doing an xml project where I have to populate 8,000 xml files 
> with a sql query... each file will contain a separate record
> 
> 
> ... the problem is that not all the diag codes are populated
> 
> So, out of diag codes 1-15 in the resultset, I may only have 7 
> actual codes... and the row-number in the output needs to be 1-7, 
> not 1,2,4,8,9 10, etc...
>  
>  
> Ive got a variable 'diagvar' to populate the row number because it > cant be hard-coded because of the nulls... 
> 

A man goes to his doctor after some tests and asks, "What's wrong with me, Doc?"

The doctor says, "Well, I've got good news and bad news, which do you want first?"

Well, the good news is that you don't have to worry about incrementing the variable, you can't increment variables in XSLT. But, I guess that's the bad news too.

It would be a great deal easier to help if we had a sample of your input and a sample of your desired output. That would give us something concrete to work with.

> Remember, this is being populated from a query, not another xml 
> file...
> 

Since XSLT can only operate on an XML document (source tree), it doesn't make any difference if the source tree's origin is a file or a database query. Please explain why it is important that the source tree comes from a query rather than a file.

-- 
Charles Knell
cknell@xxxxxxxxxx - email



Sent:     Mon, 14 Apr 2003 15:08:31 -0500
To:       <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  [xsl] Update Variables...

 
 
Hi gang, im new to this list and have something I'd like to run by you guys...
 
.. this is for a government transmission...  so I have a .net program written in vb.net that queries the sql server, and creates the .xml files... ive also attached my .xsl to the program, so when the resultset creates the .xml file it pumps it through the .xsl first and puts it in the format I need...
 
Heres the problem... 
 
 
I have to increment the row-number in the 'detail' tags, and theyre not all going to be used... heres what I mean...
 
I have diagnosis codes 1-15... I need to submit all of the ones we're capturing in the db... so diagcode1 = 4012.3, diagcode2 = 4569.09, diagcode3 = 4465.34, etc...
 
And their row-numbers would be 1-3 respectively...
 
 
 
And each one has a row-number that has to be incremented... so, diagcode 2 may be NULL, and that would leave the row-number of diagcode3 to be 2 instead of 3...
 
The sample code is below... youll notice that ive put them in when clauses... that's to weed out the nulls... if it's null, I wont build a 'detail' tag for it, but I need a way to put the right-row number should one field be null...
 
 
 
 
There are going to be 15 of these exact code segments, and the way I see it, it would just update the diagvar by one each time... like I said, if there were no NULLS, it would be easy to do... but since there are, then I don't know what to do... it would be a small miracle if I didn't have to use saxon... cause id rather not...
 
 
 
 
Thanks so much ...
 
Sean.
 
   <xsl:variable name="diagvar">
0
</xsl:variable>
    
 
 
        <xsl:variable name="ICD9CM_Other_Diag_Code1">
       <xsl:value-of select="ICD9CM_Other_Diag_Code1"/>
      </xsl:variable>    
    
 
<xsl:choose>
 
      <xsl:when test="$ICD9CM_Other_Diag_Code1!=''">
 
            <detail>
 
                  <xsl:attribute name="row-number">
       <xsl:value-of select="$diagvar"/>
       </xsl:attribute>
        
       <answer-value>
       <xsl:value-of select="ICD9CM_Other_Diag_Code1"/>
                  </answer-value>
            </detail>
      </xsl:when>
</xsl:choose>
                         
 
 
                  
 
 
 
 
 
 
 
                  
 
            
                  
                  
 
 
                  
 
                  
 
 
                  
 
 
 
 
 
 
 
 
 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread