XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 17th, 2003, 05:36 PM
visvam visvam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Alachua, FL
Posts: 5 visvam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XSLT - Generate DDLB With Reference to External XML Document

I have been beating my head against my desk for days trying to sort this problem out...

Using javascript on the client I am taking an XML document created within SQL Server using FORXML and transforming it into an XHTML form via an XSLT file.

My issue is that I need to create a select list box of states and show the state represented in the data source XML file as selected. I have tried various means - primarily the document() function - to read in the XML file of states with no success. I have searched far and wide for examples of this, since I am sure many developers have had to to this and have also come up short.

Here is some abbreviated code:

USStates.xml
Code:
<usstates> 
  <state name="Florida" abbr="FL" />
  <state name="California" abbr="CA" />
  <state name="Ohio" abbr="OH" />	
</usstates> 


XML Generated from data source
Code:
<Lead ID="62215" Status="99" RepCSR="290 - John, Smith">
  <LastUpdate>09-26-2003 20:36:56</LastUpdate>
  <LastName>Doe</LastName>
  <FirstName>John</FirstName>
  <StreetAddress>123 ABC Street</StreetAddress>
  <City>My Town</City>
  <State>FL</State>
  <ZipCode>12345</ZipCode>
  <Phone>555-555-1212</Phone>
  <EmailAddress>name@aol.com</EmailAddress>
</Lead>


FormatLeadEdit.xsl
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>

<!-- CONTAINER TEMPLATE -->
  <xsl:template match="/Lead">
    <xsl:call-template name="ContactInfo"/>
  </xsl:template>
	
<!-- CONTACT INFORMATION TEMPLATE  -->
  <xsl:template name="ContactInfo">
    <h1>Contact Information</h1>
    <p>
      <label>Name:</label>
      <input type="text" name="FirstName" value="{FirstName}" class="FormElement" />
      <input type="text" name="LastName" value="{LastName}" class="FormElement" />
    </p>
    <p>
      <label>Street Address:</label>
      <input type="text" name="StreetAddress" length="50" value="{StreetAddress}" class="FormElement" />
    </p>
    <p>
      <input type="text" name="City" value="{City}" class="FormElement" />
      <input type="text" name="State" value="{State}" class="FormElement" />
      <input type="text" name="ZipCode" value="{ZipCode}" class="FormElement" />
    </p>
  </xsl:template>
	
</xsl:stylesheet>


Currently I am just loading the value of State into a text input box in FormatLeadEdit.xsl. I need to be able to create a select list out of the USState.xml file and use the value of State from the XML data source file as the selected index all within FormatLeadEdit.xsl.

This is such an easy thing to do in VBScript - ASP, but XML/XSLT has been a real struggle for me. Any help or links to resources would be greatly appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSLT - Generate DDLB With Reference to External XML Document


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT