I don't understand what you're trying to accomplish...can you supply the result you expect (and the input)...real code...this example only has a template to match the root node and it will depend on the built in templates to process the remaining nodes...also, you may just need a variable.
Your'e stylesheet declaration is incorrect...see below...
Try changing your code from this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY foo "test"> ...
...to this **NOT TESTED** -it's been a while since I used XSLT but there are tons of resources on the web...
http://www.w3schools.com/xsl/default.asp
http://www.w3.org/TR/xslt - W3C spec
http://www.zvon.org/HTMLonly/XSLTutorial/Books/Book1/index.html - check this site out
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!ENTITY foo "test"> ...
..or if you want to use a variable substitute the ENTITY declaration with this:
<xsl:variable name="foo" select="'test'" /> (makes it global due to the declaration spot) then refer to it by using $foo
HTH, -Will
Antoine L�vy-Lambert wrote:
Hi Mike,
I am no great XSL expert.
Did you try the <xsl:import/> element instead of entities ? Maybe you are having problems with the xml-apis.jar or the xercesImpl.jar which is bundled with ant 1.5.3 ? I am not sure, I hope someone else gives you better ideas. Otherwise, there are certainly some xml lists where you could ask too. BTW : the address of this mailing list is [EMAIL PROTECTED] Cheers, Antoine
-----Urspr�ngliche Nachricht----- Von: Mike Castle [mailto:[EMAIL PROTECTED] Gesendet: Montag, 8. Dezember 2003 21:23 An: [EMAIL PROTECTED] Betreff: XSLT with entities and therefore DOCTYPE
I'm not sure if this is something that can be answered on this list. I'm hoping that at least I can be pointing to a better place to ask.
I'm delving into XSLT and have developed a transformation that works well when I use it against xsltproc on my Linux box. So I want to migrate this to ant to be part of our build process, and I'm running across errors.
In particular, this example works well:
demo.xsl: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> test </xsl:template> </xsl:stylesheet>
and from build.xml: <target name="xslttest"> <xslt in="build.xml" out="results.txt" style="demo.xsl"/> </target>
Now, in my real version, I need to use entities, so I change it to something like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY foo "test"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> &foo; </xsl:template> </xsl:stylesheet>
Which works fine with xsltproc, but ant 1.5.3 gives me:
xslttest: [xslt] Processing /homedir/mcastle/build.xml to /homedir/mcastle/results.txt [xslt] Loading stylesheet /homedir/mcastle/demo.xsl [xslt] [Error] demo.xsl:5:80: Element type "xsl:stylesheet" must be declared. [xslt] [Error] demo.xsl:6:27: Element type "xsl:template" must be declared.
BUILD SUCCESSFUL
Now, it turns out that results.txt actually holds the correct text, which is great. But that is an awful lot of noise on the screen, particularly when my real case is much larger. And that noise is distracting.
So, I've been trying to experiment with xsl:variable, but to no luck. For example, I really need to do something like the following:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="foo">[test]</xsl:variable> <xsl:variable name="bar" select="/project/target$foo"/> <xsl:value-of select="$bar"/> </xsl:template> </xsl:stylesheet>
And I've tried several variations on this technique to no avail.
So, is there anyway I can get ant to convince XSLT not to validate the stylesheet, even though it has a DOCTYPE (I really don't want to have to write a DTD for this thing)?
Or would anyone know how to hammer xsl:variables into doing what I want?
Outside of that, where do I go to ask for help (specifically, what would YOU recommend)? My searches really haven't turned up too much useful information, but I'm new enough to this that I am probably missing useful terms that would help.
Thanks a lot, mrc -- Mike Castle [EMAIL PROTECTED] www.netcom.com/~dalgoda/ We are all of us living in the shadow of Manhattan. -- Watchmen fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
