[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Referencing nodes from an out-of-scope xsl:for-eac
On Fri, May 18, 2001 at 10:57:18AM -0700, Joel P Thornton wrote: > I gave this as a relatively simple example of what I'm hoping to achieve: > > <display-columns> > <column label="Name"><B><sql-field name="title"/></B></column> > <column label="Location"><sql-field name="location"/></column> > </display-columns> > > But I am really wanting to do more complex stuff, such as this: > > <display-columns> > <column label="Name"> > <link> > <label> > <B><sql-field name="title"/></B> > </label> > <href> > /viewarea.asp?where=<sql-field name="location"/> > </href> > </link> > </column> > </display-columns> > > .. in this way permitting versatile display formatting options while > minimizing xsl work. > > Can this be done? Of course it can be done. :-) The question is, how easily can it be done, and how much control do you have, and how much sweat do you want to put into the project? > I'd love to hear suggestions .. and thanks for those so > far :) This is turning into more of an XML question. My approach would be to simplify the data you're transforming so you have simpler transforms to process in XSLT. If your input data were like this: <display-columns> <column label="Name" sql-field-name="title" class="bold"/> <column label="Location" sql-field-name="location" href="..."/> </display-columns> then your transforms would be simpler. You'd need to document the meaning of the column attributes, such that 'class' is a CSS style decoration (or an index to a series of possible HTML taggings that could be used), and that 'href' will cause an <a/> element to surround your output. That *may* work for you, if you have control of the XML coming into your transformation. Otherwise, you could play around with the <link><label/><href/></link> hierarchy you describe above, but that will be much more painful. You might want to try a two pass transform, so that the first pass simplifies the contents of <display-columns/> and the second pass matches up rows to columns. If you can't control the XML input, that's the approach I'd try. HTH, Z. 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
|