View Single Post
Old September 27th, 2006, 03:16 AM
asearle asearle is offline
Authorized User
Join Date: Sep 2006
Location: Cologne, , Germany.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Michael,

> Supplying a variable, or any other expression, as an argument to
> the document() function is perfectly OK. It's just like any other
> function.

I did more testing and see this now.

> but how is it failing? If it can't find the document, then you'll
> need to tell us more about where the document and the stylesheet
> are located.

That's the strange thing: The code finds the external document and displays the content (excellent!) but is not selectable.

I have done more diagnostics and here are my results:

Quirky thing ...

Guys: I have found out why I couldn't apply my parameter and, yes, Michael, as you say there is no problem sending and argument to Document().

Here are excerpts from my code. The A:, B:, C: labels indicate the variations which I have tried.

A: and B: work but C: only partly. Here is the code ...

<form name="formfilt" id="formfilt">
  <label for="selsrce">Source</label><br />
  <select size="5" name="selsrce" id="selsrce">

    A: <xsl:apply-templates select="person" mode="fl" />

    B: <option value="Pete">Pete</option>
       <option value="Bob">Bob</option>

    C: <xsl:apply-templates select="document('people.xml')" mode="fl" /> </select>
  <input type="button" value="ausf├╝hren" onClick="proc(document.formfilt.selsrce.value)"/>


<xsl:template match="people/person" mode="fl">
  <option value="{.}"><xsl:value-of select="."/></option>

Here is the explanation ...

I want to use this picklist (<select>) to provide a selectable list to the users and find that ...

A: I can generate a selectable list of people from the base XML (i.e. the XML from where the XSL is called):

<?xml-stylesheet href="data.xsl" type="text/xsl"?>
<?xml version="1.0"?>

B: I can select from a list hard-coded into the XSL.

Both of these options (A: and B:) are selectable and my javascript can process (and display) the result OK.

However, with version C:, where the list is stored in an external XML (i.e. people.xml), I find that I can display the list in the <select> box but, aarrrggghhh, this is not selectable (i.e. my javascript doesn't react).

I have changed nothing in my code except switch the source to the external file (file is named differently).

I am really confused about this: Why should it be that the contents of the external file can be displayed but that this stops the selection? Indeed, I even tried running it with the external file declared but the contents of the list hard-coded ...

<xsl:template match="people/person" mode="fl">
  <option value="Pete">Pete</option>

... and this also didn't work.

This makes me think that the fact that I cam connecting external files is messing up my ability to select.

I'm going to try a few other variations and will report back again.