RE: [xsl] Update Variables...

Subject: RE: [xsl] Update Variables...
From: David Christiansen <DavidCh@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Apr 2003 14:34:25 -0600
This solution is a bit off the subject, but is it possible for you to use an
SQL statement like this to get the information to pump to the XML file?

select IsNull(MyField, 'DefaultValue') from MyTable

Of course, you will need to make sure that the DefaultValue is of the same
data type as MyField.  If needed, you could even cast MyField as a different
data type such as

select IsNull(cast(MyField as char), 'DefaultValue') from MyTable

At this point, you would not need to worry about null values

-----Original Message-----
From: McCown, Sean [mailto:Sean.McCown@xxxxxxxxxxxxxxx] 
Sent: Monday, April 14, 2003 2:09 PM
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...
 
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... 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... the problem is
that not all the diag codes are populated... 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...
 
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... 
 
 
 
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...
 
Remember, this is being populated from a query, not another xml file...
 
 
 
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