xsl-list
[Top] [All Lists]

Re: Load xml into combo box

2003-06-20 10:57:39
On Fri, 2003-06-20 at 10:32, Tham Tinh wrote:
Hi all,
I have the following xml
<?xml version="1.0"?>
<SponsorOfficelist>
      <SponsorOffice>
              <OfficeName>Somewhere </OfficeName>
              <OfficeCode>1</OfficeCode>
      </SponsorOffice>
      <SponsorOffice>
              <OfficeName>Here</OfficeName>
              <OfficeCode>2</OfficeCode>
      </SponsorOffice>
      <SponsorOffice>
              <OfficeName>There</OfficeName>
              <OfficeCode>3</OfficeCode>
      </SponsorOffice>
</SponsorOfficelist>

I would like to write a xsl file to load this into
combo box.  The combo box will this place the
officename and the value for each officename will be
the officecode.  Please help me, I couldn't find the
way to make it work.

You mean like this?

<?xml version="1.0" encoding="utf-8"?>
<!--
        Author: 
        File: 
        Date: 
        Purpose: 
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
        
        <xsl:template match="/">
                <select name="test">
                        <xsl:apply-templates />
                </select>
        </xsl:template>
        
        <xsl:template match="/SponsorOfficelist/SponsorOffice">
                <option>
                        <xsl:attribute name="value">
                        <xsl:value-of select="OfficeCode" />
                        </xsl:attribute>
                        <xsl:value-of select="OfficeName" />
                </option>
        </xsl:template>
</xsl:stylesheet>

-- 
   ´¨)
 ¸.·´¸.·´¨)    ¸.·´¨)
(¸.·´    (¸.·´   .·´ ¨¨°º©Rob Rohan©º°¨¨°º ¨¨°º©?

http://treebeard.sourceforge.net
http://ashpool.sourceforge.net



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>