homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

importing simple xml strings into html

Msg#: 4289987 posted 8:22 am on Mar 31, 2011 (gmt 0)

Hi, I have a very simple xml file like this:

<Text1>first text going to website
<Text2>second text going to website

I need my html(index) file to pick up the text from the xml file. What is the simplest solution how to do this? Could anyone please give me help in how to code this?

The nearest I am a solution, is doing as follows - making a xsl file looking something like this:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
<xsl:value-of select="MyText/Text1" /><br/>

and linking to it in the xml file via this line

<?xml-stylesheet type="text/xsl" href="xslfile.xsl"?>

But I don't know how to put this in the right place of my html file.

Or are there other ways to do this?
I appreciate all the help I can get!



WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4289987 posted 5:56 pm on May 11, 2011 (gmt 0)

your best bet is to use a server-side programming language like PHP, C#, Java, Perl, Ruby, or whatever you're comfortable with... use it to grab the XML file, parse it to get the text, and output that into your HTML layout.

XSL transformation is typically performed on an entire document; it's not possible (AFAIK) to drop a little piece of it into HTML.

It's possible to do it with JavaScript, but I don't recommend it.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved