473,898 Members | 2,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web service throwing XML - XSLT transformation, how?

Hello,
I have sort of a big problem. I would really appreciate any help you
could give me.
I made a web service in C++ that throws XML to the client (browser).
But, the XSLT transormation (xml->html) doen't happen!

I have XSLT files for this, they work, I mean when I put the output of
the app as an XML file on some server, and make it use the XSLT files to
transform into HTML, it works, I get a HTML page.

The XSLT file is on a separate server, the XML is thrown 'inline'
so-to-speak, it's dumped directly on the client's socket. But as I say,
it doesn't render to HTML. How can I make this work? Can I throw an XSLT
file inline too? How do I do that?

Right now I throw the XML output to the client's socket with
Content-type: text/html

Of course I've tried throwing it with Content-type: application/xml but
that didn't ail anything.

Can anybody tell me what I need to do to make the client-side xslt
transformation happen, with this kind of set-up?

So, to summarize :

situation now:
1. Client's browser asks my web service a HTTP GET request.
2. My server dumps XML on the client's socket. (with the correct HTTP
headers etc)
3. My client gets the XML code, but the XSLT transformation (that's
specified in the XML code) does not happen!

how it should be:
3. The XSLT should happen and the client gets HTML on his browser.

Why doesn't this happen? I suspsect it ahs something to do with the MIME
type my web service throws at the client, but what?

Thanks so much for any help,

--
- gipsy boy
Jul 20 '05
12 3248
gipsy boy wrote:

Thanks again!
I did this for myself now, and get a parsing error in the XSLT.

Is the root tag in your xslt the tag "RIDERS"?

I simplified the stylesheet, and now I have this code for the xml file.
It says "Error loading stylesheet: Parsing an XSLT stylesheet failed."
Any ideas?
<?xml version="1.0" encoding="ISO88 59-1"?>
<!DOCTYPE APPLICATION [
<!ATTLIST xsl:stylesheet id ID #REQUIRED>
]>
<?xml-stylesheet type="text/xml" href="xslt"?>
<APPLICATION>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" id="#xslt">


Sorry I made a mistake here of course, with the id/href.
I get an empty document now, it seems like the only tag that is
transformed is the root, APPLICATION tag.
The other tags aren't.
Can I see the rest of your xml code? I'm sure I'll be able to figure out
then.
Thanks so much for your help, btw, never coudl've done this without.

--
gipsy boy
Jul 20 '05 #11
gipsy boy wrote:
gipsy boy wrote:

Thanks again!
I did this for myself now, and get a parsing error in the XSLT.

Is the root tag in your xslt the tag "RIDERS"?

I simplified the stylesheet, and now I have this code for the xml
file. It says "Error loading stylesheet: Parsing an XSLT stylesheet
failed."
Any ideas?
<?xml version="1.0" encoding="ISO88 59-1"?>
<!DOCTYPE APPLICATION [
<!ATTLIST xsl:stylesheet id ID #REQUIRED>
]>
<?xml-stylesheet type="text/xml" href="xslt"?>
<APPLICATION>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" id="#xslt">

Sorry I made a mistake here of course, with the id/href.
I get an empty document now, it seems like the only tag that is
transformed is the root, APPLICATION tag.
The other tags aren't.
Can I see the rest of your xml code? I'm sure I'll be able to figure out
then.
Thanks so much for your help, btw, never coudl've done this without.


Nevermind, solved it already. Doing very silly things today..
Thanks again,
--
- gipsy boy
Jul 20 '05 #12


gipsy boy wrote:
I get an empty document now, it seems like the only tag that is
transformed is the root, APPLICATION tag.
The other tags aren't.
You can run load the XML in the DOM inspector then you will be able to
see the result tree of the transformation.
Can I see the rest of your xml code? I'm sure I'll be able to figure out
then.


The example is this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xml" href="#xslt"?>
<!DOCTYPE riders [
<!ELEMENT xsl:stylesheet ANY>
<!ATTLIST xsl:stylesheet
id ID #REQUIRED
version CDATA #FIXED "1.0"
xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform">
]>
<riders>
<xsl:styleshe et id="xslt"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<html>
<head>
<title>Riders </title>
</head>
<body>
<xsl:apply-templates select="riders" />
</body>
</html>
</xsl:template>
<xsl:template match="riders">
<table border="1">
<tbody>
<xsl:apply-templates select="rider" />
</tbody>
</table>
</xsl:template>
<xsl:template match="rider">
<tr><td><xsl:va lue-of select="." /></td></tr>
</xsl:template>
</xsl:stylesheet>

<rider>Lance Armstrong</rider>
<rider>Jan Ullrich</rider>

</riders>

But be aware that IE/MSXML do not support the embedded stylesheet e.g. the
<?xml-stylesheet type="text/xml" href="#xslt"?>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2715
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
6
2753
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
6
2936
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for this, and came across a problem that I haven't been able to solve elegantly. The problem is to find "linker" vertexes that a pair of verteces from a pre-defined set. For example, if the graph verteces represent cities and edges represent flights...
1
3115
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP Transformer convert that via XSLT to valid XSL-FO. So I define a SAXReader which fires the SAX Events for the Java Object. This works fine and the Transformation to PDF is ok. However, I have one object which contains an XHTML String and the tags
4
5256
by: Stephen | last post by:
I have the following that outputs an xml file to a div using ajax: <script type="text/javascript"> function ajaxXML(url,control_id){ if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) {
5
4417
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from which it generates the various XSLs). We have considered instead using InfoPath, which is WYSIWYG,...
4
2145
by: simon.a.hulbert | last post by:
Hi, I'm trying to view the following xslt transformation using firefox <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:output method = "xml" indent = "yes" /> <xsl:attribute-set name = "set1" > <xsl:attribute name = "a" >1</xsl:attribute> <xsl:attribute name = "b" >2</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name = "set2" >
4
2031
by: stuart.jones | last post by:
Dear all I have a Windows Service that retrieves some data as XML, applies an XSLT to produce a CSV which is saved to the filesystem as a text file. This all works fine. Depending upon the configuration, this file is then 1. copied to another location 2. attached to an e-mail message 3. FTPed to a particular location
2
3105
by: Jonny B | last post by:
Hi all, I'm working on an a clientside xslt using jscript that passes a parameter to the xsl. I've got it working no problem in IE but cant get it to work in Mozilla. Can anyone help? This is my IE code - <html> <head> <title>CEL Learning</title>
0
9993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9840
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9661
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7187
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5880
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4706
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3305
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.