Welcome to WebmasterWorld Guest from 34.238.192.150

Forum Moderators: open

Message Too Old, No Replies

Real basic XSLT question from newbie

     

RezMonkey

7:30 pm on Sep 15, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


Hi all,

I am working on my first XML/XSLT project and I am confused about one thing (so far ;): How do I pass a variable from one transform to another? This is a real basic question but I can't find a clear explanation of how to do it or why it isn't possible.

I have an XML file with full details for club venues. I want a list of names and logos, and to build a "more information" link that will load a detail page that will access different nodes of the same XML file, so I would like to pass the venue ID in the URL. Is there no way to pick a variable out of a URL?

Please have patience with me. If this question is stupid and there is a super beginner's tute somewhere you can point me to, that would be appreciated too.

Thanks!

7:11 am on Sept 16, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 28, 2003
posts:14
votes: 0


XSL doesn't understand URLs in itself. You would probably need to process the URL and extract the ID in server-side scripting such as CGI, ASP or PHP. Having extracted the ID from the URL, you could pass that as a parameter when you call your XSL transform, which would in turn display the appropriate information.

Or, if you are happy to have both the index and the more information on the same page, this is quite easy to build in XSL using two separate templates within the same XSL file. The first one parses the XML and builds the index with internal jump hyperlinks, and the second parses it again to build the detail parts with anchor points.

RezMonkey

4:19 pm on Sept 16, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


Danny thank you very much for your reply. Unfortunately I am abstracted from the server using closed templates on a CMS so I don't have access to scripting languages. Your suggestion intrigues me, but I'm not sure exactly how to build internal jump hyperlinks or anchor points. Are you talking about having the index at the top and all the full details at the bottom like:

<a href="#id">more information</a>
...
...
...
<h3 id="id">Full details about venue</h3>
...
...
...

Or is this an XSLT/XPath technique? My file is too complicated to display everything on one page load. Can you elaborate?

Thank you!

6:36 pm on Sept 18, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 28, 2003
posts:14
votes: 0


If you are unable to extract the ID of the club venue then unfortunately I can't see how you can create an XML-based master-detail type application, because I can't see any way of passing the parameter from page to page. Therefore the first suggestion won't work.

My second suggestion was, as you understood, to create an index at the top of a page, with links down to the details using a template that creates a list of <a href="#12>Club venue</a> tags, and a second template which creates a list of <a name="12"><h1>Title</h1></a> type records. If that won't work for you because of the size of the dataset, then I'm afraid I'm stumped.

Any other XSLT gurus know the answer?

RezMonkey

10:45 pm on Sept 18, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


We're using MSXML if that is any help..
10:52 pm on Sept 19, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 17, 2001
posts:1262
votes: 0


RezMonkey, welcome to WebmasterWorld. It would help tremendously if you post a sample of your input XML and the output you would like to achieve; what it sounds like you want to accomplish should be relatively straightforward.
5:03 pm on Sept 25, 2005 (gmt 0)

New User

10+ Year Member

joined:Aug 30, 2005
posts:7
votes: 0


yea im about to work on my for the first time to