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
Solved

xslt and document() function

Posted on 2002-05-30
3
338 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&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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mongodb hierarchy 2 59
tutorial for ebay api 3 55
PowerShell script to remove string in xml file 8 30
Create animated movies for web page 18 83
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
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.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

809 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