[xsl] WD-xsl: Variables, XSL(T) conversion, etc

Subject: [xsl] WD-xsl: Variables, XSL(T) conversion, etc
From: Nileblitz <nileblitz@xxxxxxxxx>
Date: Wed, 29 Dec 2004 06:44:47 -0800 (PST)
I have read many posts on this list related to similar
problems.
 
I have taken over support activities for an
application. One page of 
this application is XML-XSL based.
 
I was asked to provide certain default values for a
few dropdown lists 
generated by the xsl. I realized based on past
experience that this is 
not going to be an easy task because the system was
coded in WD-xsl. I 
cannot use variables and parameters.
 
I tried converting to XSLT using the converter
provided by MS, but it 
leaves much to be desired. Considering the huge size
of the XSL and the 
lack of impact analysis, I dont wish to proceed with
the conversion 
without proper approval. Meanwhile I am trying to find
a solution if I 
can. I am posting the relevant XML and XSL and I will
try to explain the 
problem in detail.
 
XML
---------------------------------------------------------------------------------------
<ReportDefinition ID=1>
  <SearchForm>
   <Edit Caption="Global/Market"
FieldName="GlobalorMarket" 
Type="Combo" Source="GlobalorMarket"
ListId="GlobalorMarket" DefValue="Global"/>
  </SearchForm>
</ReportDefinition>
<ReportDefinition ID=2>
   <Edit Caption="Global/Market"
FieldName="GlobalorMarket" 
Type="Combo" Source="GlobalorMarket"
ListId="GlobalorMarket" DefValue="Market"/>
  </SearchForm>
</ReportDefinition>
.
.
 
   <GlobalorMarket>
      <Type IDVALUE="Global">Global</Type>
      <Type IDVALUE="Market">Market</Type>
   </GlobalorMarket>

----------------------------------------------------------------------
XSL
----------------------------------------------------------------------
.
.
.
<Select>
<xsl:if test="../@ListId[. = 'GlobalorMarket']">
 <xsl:for-each select="//GlobalorMarket/Type">
  <option>
   <xsl:attribute name="VALUE"><xsl:value-of 
select="../@IDVALUE"/></xsl:attribute>
   <xsl:if test="@IDVALUE[.='Global']"><xsl:attribute 
name="SELECTED"/></xsl:if>
   <xsl:value-of select="." />
  </option>
 </xsl:for-each>
</xsl:if>
</Select>
.
.
.
------------------------------------------------------------------------
 
Problem: As you can see from the XSL, currently the
default value for 
all the "GlobalorMarket" select boxes is set to
"Global". But for 
different report definitions the default value should
be different (DefValue 
attribute in XML section). The problem is, how to
access this DefValue 
attribute inside the for-each loop because the context
is different and 
we cannot use variables.
 
Let me know if you have any thoughts on this.



		
__________________________________ 
Do you Yahoo!? 
Dress up your holiday email, Hollywood style. Learn more. 
http://celebrity.mail.yahoo.com

Current Thread