[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] WD-xsl: Variables, XSL(T) conversion, etc
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Wed, 29 Dec 2004 09:33:51 -0600

Hi Nileblitz,

As you may know XSLT does have variables, but once assigned you cannot
change them. You also say that you cannot use parameters. Well, then you may
revert to using recursion; some examples are given here:
http://www.xmlpitstop.com/Examples/ShowHighlightedExample.aspx?Example=Recur
sion

On the other hand, did the conversion work at all? Just curious... If the
XSLT is very big, that's bad news - but it must be possible to break it into
modules where each one could be converted independently.

Cheers,
<prs/>

-----Original Message-----
From: Nileblitz [mailto:nileblitz@xxxxxxxxx]
Sent: Miircoles, 29 de Diciembre de 2004 08:45 a.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] WD-xsl: Variables, XSL(T) conversion, etc

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
Keywords