Re: [xsl] Putting parameter into XPATH expression

Subject: Re: [xsl] Putting parameter into XPATH expression
From: "MacEwan, James (Information Services)" <James.MacEwan@xxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Jun 2001 09:30:22 -0500
Thanks all,

Yes I was indeed passing in a string instead of a number.  (My dumb
mistake).  Not putting single quotes around the param is the right answer.
(For those older folks on the list, you will find some irony in a recent
problem that I was having where I was missing single quotes.  I guess I'll
learn soon enough or I'll have to get an anonymous email address like
"xslayer@xxxxxxxxxxx" perhaps and stop embarassing myself.)

Wendell Piez's asks "But why not just write a stylesheet that traverses the
tree in the normal way?".  His point is quite valid and I fully agree that
one should usually let XSL do its thing and have its rules fired by the XML
data as it occurs.  (Tom P had a similar comment.)

In the example that I posted, I had removed a lot of code to demonstrate the
trouble I was having with those single quotes.  Because of the
simplification it was no longer obvious to any one reading it that I have to
control the flow of the output using logic in the stylesheet.  But do I have
to control the flow?  Hmm.

Since we are now on the topic of design patterns.  Perhaps someone would
care to comment on my approach to my problem?  I have exactly 6 list boxes
on an HTML page that I am using as jump menus.  The XML structure looks
basically like this (Note that Menus can contain Menus.  This approach is
taken so that if someone decides to replace the listboxes with cascading
menus, we will be able to have an arbitrary number of menus containing menus
containing menus):

    <EnglishName>Menu One</EnglishName>
    <FrenchName>Le Menu Un</FrenchName>
      <EnglishName>Item One</EnglishName>
      <FrenchName>L'item Un</FrenchName>
      <EnglishName>Item Two</EnglishName>
      <FrenchName>L'item Deux</FrenchName>
    <!-- bunch more items in menu one -->

    <EnglishName>Menu Two</EnglishName>
    <FrenchName>Le Menu Deux</FrenchName>
    <!-- bunch of menu items for menu two -->

  <!-- exactly six <Menu>'s belong to the <Menus> node -->

On the output page each of these six menus has different HTML code around
it.  I have written the XSL so that it manually pulls the menu data in:
	<!-- put out HTML until the first menu -->
	<!-- call template that reads in first menu data and puts out the
HTML menu -->
	<!-- put out HTML between the first and second menu -->
	<!-- call template that reads in second menu data and puts out the
HTML menu -->
	<!-- put out HTML between the second and third menu -->
	<!-- call template that reads in third menu data and puts out the
HTML menu -->

	<!-- and so on until the code after the sixth menu is put out... -->

It is because the HTML between the menus can be quite arbitrary, that I went
with the pull approach.

Thanks all,

James MacEwan
Software Developer
Investors Group Inc.
v: (204) 956-8515
f: (204) 943-3540

"I don't know, lad. It's like no cheese I've ever tasted." -- Wallace

 XSL-List info and archive:

Current Thread