Solved

xslt and document() function

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

821 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