Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Choosing Which XSL File To Use [Thread Next] Re: Choosing Which XSL File To UseTo: NULL Date: 5/9/2005 10:10:00 AM "MDW" <MDW@d...> wrote in message news:AEB08E80-ACF1-43EF-922A-B3EE0921932A@m...... > Hey all, > > I'm just starting out with XML/XSL, so I apologize if this is a stupid > question. I'm working on formatting some XML documents for display on the Web > (I doubt there will be any other use of them for any other application). > > I'm thinking of creating a single XML file containing information about > pictures. One or more pictures will be contained within an <event> element > (an event will be something like a vacation, a party, etc.). So it'll look > something like this: > > <photoCollection> > <event name="Birthday Party"> > <photo file="party1.jpg"/> > <photo file="party2.jpg"/> > <photo file="party3.jpg"/> > </event> > <event name="Vacation"> > <photo file="vac1.jpg"/> > <photo file="vac2.jpg"/> > <photo file="vac3.jpg"/> > </event> > ... > </photoCollection> > > I want to be able to click on a link and display JUST the pictures from the > Birthday Party, and then have another link to display JUST the pictures from > the vacation, etc. What is the best way to accomplish this? Thanks. > -- > Hmm...they have the Internet on COMPUTERS now! Basically you need to select: /photoCollection/event[@name = $eventname] Assuming you are using MSXML then there are two basic ways to set $eventName before running the transform. Let's say you have the following param decalred globally: <xsl:param name="eventName" /> The first way is a slight hack, open the XSLT file as a domDocument and select the param element, set its select attribute to the event required and transform. The official way is to use the addParameter method of the XSLTProcessor class, see here for examples: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmconIncreasingPerformancebyUsingtheXSLTemplateObject.asp?frame=true This is the best method to use if you expect many hits but is more memory intensive for one off transforms. -- Joe (MVP - XML) https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
