Subject: RE: [xsl] WD-xsl: Variables, XSL(T) conversion, etc From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx> Date: Wed, 29 Dec 2004 10:39:38 -0500 |
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 -----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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] WD-xsl: Variables, XSL(T), Pieter Reint Siegers | Thread | Re: [xsl] WD-xsl: Variables, XSL(T), Nileblitz |
RE: [xsl] WD-xsl: Variables, XSL(T), Pieter Reint Siegers | Date | Re: [xsl] template selection based , JBryant |
Month |