Solved

xslt and document() function

Posted on 2002-05-30
3
334 Views
Last Modified: 2013-11-18
Hi all

I have a question about using the document() function in xslt.  I want to be able to grab an xml document from moreover.com through the document function, but unfortunantely, the url contains some illegal characters.

Has anyone ever gotten this to work?
Here is an example:

               <xsl:for-each select="document('http://p.moreover.com/cgi-local/page?c=Mutual%20funds%20news&o=xml')/moreovernews/article">
                    <xsl:value-of select="headline_text"/>
               </xsl:for-each>

and here is what i get back from xalan:

javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The reference to entity "o" must end with the ';' delimiter.

Help!!
(windowsxp, xerces, xalan on jdk 1.4 with tomcat 4.0.3)
Newman
0
Comment
Question by:ScottNewman
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
eli_frandsen earned 50 total points
ID: 7046377
Hi ScottNewman

I think the problem is &o
When xsl encounters & it expects an entity that ends with ;
So to write & you have to use the entity &amp;
Use:
<xsl:for-each select="document('http://p.moreover.com/cgi-local/page?c=Mutual%20funds%20news&amp;o=xml')/moreovernews/article">

This should give a result

Regards
Eli_frandsen
0
 
LVL 1

Expert Comment

by:eli_frandsen
ID: 7046378
Please note that the & you see in the answer
whould be substituted with & amp;
(leave out space)
0
 
LVL 2

Author Comment

by:ScottNewman
ID: 7046776
perfect!  Did the trick.

Thank you.
Scott
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now