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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 8th, 2003, 05:22 AM
neobuddah's Avatar
neobuddah neobuddah is offline
cosmos curator
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2002
Location: Leeds, UK
Posts: 678 neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 14 h 17 m 49 sec
Reputation Power: 8
Unhappy XML > HTML, outputting into quotes?

Hi people.

I'm new to the whole XML/XSL lark, coming from a HTML/PHP/MySQL background.

I'm having fun creating an application that currently uses IE's built-in parsing engine, but i've hit a problem.

How do I translate an attribute from XML to HTML?

Such as the following...

Code:
<!-- xml file -->
<?xml version="1.0"?>
<base>
  <item id="1" />
  <item id="2" />
  <!-- etc -->
</base>

<!-- xsl file -->
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
  <xsl:for-each select="item">
    <ul>
      <li id="<xsl:value-of select="@id" />"><xsl:value-of select="@id" />
    </ul>
  </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>


I'm sure someone's come across this before, but none of the tutorials i've come across have mentioned anything to do with this.
__________________
R.T.F.M - Its the only way to fly...

"No matter what you do, or how good it is, someone will always ask for more features. Or to change the colour of something, then change their minds."

Personal:
experience// 8 Years Web Development
technologies// Standards-compliant, valid, & accessible (x)HTML/CSS, XML/XSL/XPath/XQuery/XUpdate, (OOP) PHP/(My)SQL, eXist/Xindice/XMLDBs
packages// Photoshop, Illustrator, Flash/Fireworks/Director
environment// FC2, MySQL, Lighttpd, PHP5, Mojavi/Agavi
site// //refactored.net/ (Coming soon...)
quote// Programming is the eternal competition between programmers who try to make apps more and more idiot proof and the universe that makes dumber idiots. So far, the universe is winning...

Reply With Quote
  #2  
Old July 8th, 2003, 05:37 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
Try the following:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" indent="yes"/>

<xsl:template match="/">
<HTML>
<BODY>
<xsl:for-each select="base/item">
<ul>
<li id="{@id}"/><xsl:value-of select="@id"/>
</ul>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

Reply With Quote
  #3  
Old July 8th, 2003, 05:40 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
Sorry ...

Code:
<?xml version="1.0"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xslutput method="html" indent="yes"/> 

<xsl:template match="/"> 
<HTML> 
<BODY> 
<xsl:for-each select="base/item"> 
<ul> 
<li id="{@id}"/><xsl:value-of select="@id"/> 
</ul> 
</xsl:for-each> 
</BODY> 
</HTML> 
</xsl:template> 
</xsl:stylesheet>

Reply With Quote
  #4  
Old July 8th, 2003, 05:50 AM
neobuddah's Avatar
neobuddah neobuddah is offline
cosmos curator
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2002
Location: Leeds, UK
Posts: 678 neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 14 h 17 m 49 sec
Reputation Power: 8
Thanks for your help. Works great with attributes. And works with Javascript. Bonus!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML > HTML, outputting into quotes?


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 4 hosted by Hostway