[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

Subject: Re: Referencing nodes from an out-of-scope xsl:for-each loop
From: Adam Turoff <ziggy@xxxxxxxxx>
Date: Fri, 18 May 2001 14:21:15 -0400
html taggings
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:
     <column label="Name" sql-field-name="title" class="bold"/>
     <column label="Location" sql-field-name="location" href="..."/>

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.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.