?
Solved

xslt and document() function

Posted on 2002-05-30
3
Medium Priority
?
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
eli_frandsen earned 200 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&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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

765 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