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

Subject: Re: [xsl] WD-xsl: Variables, XSL(T) conversion, etc
From: Nileblitz <nileblitz@xxxxxxxxx>
Date: Thu, 30 Dec 2004 04:56:29 -0800 (PST)
Hey guys, thanks for the information.

There was no solution other than converting the WD-xsl
to XSLT. Unfortunately when I used the Microsoft XSL
to XSLT Converter 1.1, it crapped all over the huge
XSL. Thankfully I had sourcesafed it otherwise I was
going to be in deep shit on this beautiful day at the
end of the year.Also I noticed that the converter had
increased the file size more than double the original.

I converted the whole thing manually. It took a couple
of hours, but I think it was worth the effort.

Cheers
And have a great 2005!!


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

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=3D=
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]=20
Sent: Mi=E9rcoles, 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.
=20
I have taken over support activities for an
application. One page of =
this
application is XML-XSL based.
=20
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.
=20
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.
=20
XML
------------------------------------------------------------------------=
----
-----------
<ReportDefinition ID=3D1>
  <SearchForm>
   <Edit Caption=3D"Global/Market"
FieldName=3D"GlobalorMarket"=20
Type=3D"Combo" Source=3D"GlobalorMarket"
ListId=3D"GlobalorMarket" DefValue=3D"Global"/>
  </SearchForm>
</ReportDefinition>
<ReportDefinition ID=3D2>
   <Edit Caption=3D"Global/Market"
FieldName=3D"GlobalorMarket"=20
Type=3D"Combo" Source=3D"GlobalorMarket"
ListId=3D"GlobalorMarket" DefValue=3D"Market"/>
  </SearchForm>
</ReportDefinition>
.
.
=20
   <GlobalorMarket>
      <Type IDVALUE=3D"Global">Global</Type>
      <Type IDVALUE=3D"Market">Market</Type>
   </GlobalorMarket>

----------------------------------------------------------------------
XSL
----------------------------------------------------------------------
.
.
.
<Select>
<xsl:if test=3D"../@ListId[. =3D 'GlobalorMarket']"> 
<xsl:for-each
select=3D"//GlobalorMarket/Type">
  <option>
   <xsl:attribute name=3D"VALUE"><xsl:value-of
select=3D"../@IDVALUE"/></xsl:attribute>
   <xsl:if
test=3D"@IDVALUE[.=3D'Global']"><xsl:attribute
name=3D"SELECTED"/></xsl:if>
   <xsl:value-of select=3D"." />
  </option>
 </xsl:for-each>
</xsl:if>
</Select>
.
.
.
------------------------------------------------------------------------=

=20
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.
=20
Let me know if you have any thoughts on this.

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

------------------------------

Date: Wed, 29 Dec 2004 10:39:38 -0500
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx>
Subject: RE: [xsl] WD-xsl: Variables, XSL(T)
conversion, etc
Message-Id: <200412291046437.SM02768@jim>

Greetings Nileblitz,

Something else to consider is to break the problem
down into bite-size
pieces.  If I were doing this, first I would establish
a variable that 
I
could use as sort of a lookup table.  You can create
variables that =
contain
fragments of an XML document and then use them as a
lookup device 
within
your XSLT stylesheet.

You can construct your lookup variable at the top of
your stylesheet =
before
you do your first template match (although I don't
know if actual =
placement
within the stylesheet matters).  Within the variable
tags you can =
traverse
your souce document and massage the data into a
different format; =
pulling
out only what you need to perform your lookup.

Then, when you actually go to process each template,
you can call into 
=
your
variable to do a lookup.

Just my 2 cents.

--Jim Neff

=20




		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

Current Thread