|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Re: whats the best way to create and use values fo
Abhishek,
For reasons explained by Ken, I don't think your solution will work the way you are describing; but I'm not sure you need the control over the scope of variables you say you require..... At 08:58 PM 9/13/2003, you wrote: Now my document has various chapters which have various sections where a given section can have any number of matrices (matrix) and/or paragraphs. By this, do you mean hard-code these values into your source document, or into your stylesheet? If into your source document, then each section would contain a particular set of nodes providing the parameters you want. So a section could look like: <section SectionHeading='MySectionSomething1'> <table-params> <col which="MC1Width">30</col> <col which="MC2Width">40</col> <col which="MC3Width">25</col> <col which="MC4Width">50</col> <col which="MC5Width">70</col> </table-params> Then in your stylesheet, the values are accessible from any template, given an XPath. So inside a table, you could always retrieve ancestor::section[1]/table-params/col[@which=$colName] ... or you can first bind ancestor::section/table-params/col to a variable colSpecs and then ask for $colSpecs[@which=$colName].... If you want these values to be in the stylesheet, then use the lookup table technique Dimitre demonstrated.... <my:table-specs>
<section SectionHeading='MySectionSomething1'>
<col which="MC1Width">30</col>
<col which="MC2Width">40</col>
<col which="MC3Width">25</col>
<col which="MC4Width">50</col>
<col which="MC5Width">70</col>
</section>
<section SectionHeading='MySectionSomething2'>
....
</section>
</my:table-specs>Binding my:table-specs to a variable <xsl:variable name="table-specs" select="document('')/*/my:table-specs"/> You can always say $table-specs[@SectionHeading=current()/ancestor::Section[@SectionHeading]/col[@which=$colName] I hope that helps. Many times "parameterizing" something in XSLT doesn't actually require formal parameters or variables -- it's just retrieving node values (but those values have to be in a tree somewhere, or calculable). Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








