Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Choosing Which XSL File To Use

From: "Joe Fawcett" <joefawcett@----------.------>
To: 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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent