xslt problem
This is an open discussion with 8 replies, filed under General.
Search
Cannot transform: Error at line 7, column 12: Failed to parse QName 'xsl:'
The clue is in the error message :-)
On line 7 of hello.xsl you have:
<xsl: value-of-select="title" />
Column 12 (the 12th character on the line) is the space between xsl:
and value-of
. This isn't valid XML, so remove the space and you should be good.
For clarity: element names in XML (and HTML) cannot contain spaces. XSLT is actually just XML, and all of its elements are prefixed with the xsl
namespace. So the value-of element is an XML element named: <value-of ... />
, but with an XSLT namespace: <xsl:value-of .../>
. Either way, it cannot contain spaces :-)
Thanks
I changed it to this : <xsl:value-of-select="title" /> but now I get this message:
Error at line 7, columm 27 : not well formed (invalid token)
Roelof
Found that problem : it has to be
But I see another problem: When I do a transform I see this as output :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
it is
<xsl:value-of select="title" />
without -
(dash) before select
.
Oke I found that already. Somehow my code did not go the right way.
The output I get you can find here : http://pastebin.com/2haf5kzT
So as you can see the whole body has disappear.
Roelof
You need to define a template for /
as that's your root node (it always is). From there on you can go and select page
.
oke,
Then the tutorial is not right. They don't talk about a template for /
Roelof
No one a idea what went wrong or can I better forget about this tutorial.
Roelof
Create an account or sign in to comment.
hello,
Im following this page to learn xslt : http://edutechwiki.unige.ch/en/XSLT_Tutorial_-_Basics
So I made a two files named hello.xml and hello.xsl with xmlcopyeditor. Both files are well-formed.
But when I do xsl transform to make the html page I see this message: Cannot transform: Error at line 7, column 12: Failed to parse QName 'xsl:'
Here are both files.
hello.xsl :
hello.xml :
I did type exactly what in the page. Can anyone help me find out what went wrong here?
Roelof
Edit: updated code to fix forum formatting problem (Nick)