Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML XSL - Combo box problems 2

Status
Not open for further replies.

Sniipe

Programmer
Oct 9, 2006
115
IE
I'm new to the world of XSL. I have gotten my HTML page to a point where textboxes, labels, headers, etc have been outputted perfectly.

The problem I'm having is with this code:

<xsl:template match="/Selectlist/Select">
<select name="menu">
<option>
<xsl:attribute name="Value">
<xsl:value-of select="ID" />
</xsl:attribute>
<xsl:value-of select="Name" />
</option>
</xsl:template>

This code appears after: <xsl:template match="/"> ... </xsl:template>

I'm getting no output or error afer the ouput from the first <xsl:template match=.../>
 
I think we'll need to see how this template might be invoked.

Your template that matches "/" is responsible for keeping the process going. So, what are you doing inside that template to invoke the template that matches /Selectlist/Select?

Tom Morrison
 
Hello k5tm, thanks for your response. Its a small xml file and this is my first time really getting involved with it.
Here is the format:

<?xml version=\"1.0\"encoding=\"ISO-8859-1\"?>
<XMLQuestion>
<Header>Screen number: 1</Header>
<Label>Enter name</Label>
<Textbox>Name</Textbox>
<Selectlist>
<Select>
<Name>Dublin</Name>
<ID>1</ID>
</Select>
<Select>
<Name>Cork</Name>
<ID>2</ID>
</Select>
<Select>
<Name>Galway</Name>
<ID>3</ID>
</Select>
</Selectlist>
<Button>Next Screen</Button>
<Javascript>fnNextScreen(2)</Javascript>
</XMLQuestion>

Basically, out of this I have so far working:
the label, the textbox and the button. The problem is with the combo box, the code which is in my first thread.

 
Just in case you may miss something, this is one possible structures to make it happen in the xsl that you can identify what is missing in yours.
[tt]
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="XMLQuestion">
<html>
<body>
<form>
<select name="menu">
<xsl:apply-templates select="Selectlist/Select" />
</select>
</form>
</body>
</html>
</xsl:template>
<xsl:template match="Selectlist/Select">
[red]<!-- <select name="menu"> -->[/red] <!-- take this out -->
<option>
<xsl:attribute name="Value">
<xsl:value-of select="ID" />
</xsl:attribute>
<xsl:value-of select="Name" />
</option>
</xsl:template>
[/tt]
(In particular, the open tag of select is not in the template matching Selectlist/Select.)
 
Thank you both. I have gotten the XML:XSL working. I'm moving on to more complicated stuff now, so I may be back again. Thanks a million.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top