Solved

xslt and document() function

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File names with & character 6 69
Merge 2 XML Files together 5 46
Viewing XML as a table on a Mac 3 86
.php tree directory? 5 54
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…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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)

937 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

5 Experts available now in Live!

Get 1:1 Help Now