ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dalg...@ix.netcom.com (Mike Castle)
Subject Re: AW: XSLT with entities and therefore DOCTYPE
Date Wed, 10 Dec 2003 01:34:16 GMT
In article <3FD4F00B.3000902@eds.com>, Will Lopez  <user@ant.apache.org> wrote:
>A very good XSL list is xsl-list@lists.mulberrytech.com.

Unfortunately, when I checked the archives (prior to posting here), I was
unable to find anything directly addressing my real issue (which is the
parser yelling at me for no reason).

>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.

Ok.  Here.

mcastle@dl-mcastle[04:46pm]~/test(1812) cat build.xml
<project name="test" default="xslttest" basedir=".">

<target name="xslttest">
   <echo message="before test"/>
   <xslt in="build.xml" out="results.txt" style="demo.xsl"/>
   <echo message="after test"/>
</target>

</project>

mcastle@dl-mcastle[04:46pm]~/test(1813) cat 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="/">
    <xsl:number value="count(/project/target[echo])"/>,
    <xsl:number value="count(/project/target/echo)"/>.
  </xsl:template>
</xsl:stylesheet>

mcastle@dl-mcastle[04:48pm]~/test(1821) cat results.txt 
<?xml version="1.0" encoding="UTF-8"?>
1,
    2.



>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">
>..

Huh?  That very well IS correct!

mcastle@dl-mcastle[04:51pm]~/test(1825) cat demo.xsl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY foo "[echo]">
]>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:number value="count(/project/target&foo;)"/>,
    <xsl:number value="count(/project/target/echo)"/>.
  </xsl:template>
</xsl:stylesheet>
mcastle@dl-mcastle[04:51pm]~/test(1826) cat results.txt 
<?xml version="1.0" encoding="UTF-8"?>
1,
    2.


>..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">

that is broken XML, however:

mcastle@dl-mcastle[04:52pm]~/test(1828) cat demo.xsl 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!ENTITY foo "[echo]">
  <xsl:template match="/">
    <xsl:number value="count(/project/target&foo;)"/>,
    <xsl:number value="count(/project/target/echo)"/>.
  </xsl:template>
</xsl:stylesheet>

mcastle@dl-mcastle[05:32pm]~/test(1829) ant
Buildfile: build.xml

xslttest:
     [echo] before test
     [xslt] Processing /homedir/mcastle/test/build.xml to /homedir/mcastle/test/results.txt
     [xslt] Loading stylesheet /homedir/mcastle/test/demo.xsl
     [xslt] [Fatal Error] demo.xsl:3:3: The content of elements must consist of well-formed
character data or markup.
     [xslt] : Fatal Error! org.xml.sax.SAXParseException: The content of elements must consist
of well-formed character data or markup. Cause: org.xml.sax.SAXParseException: The content
of elements must consist of well-formed character data or markup.
     [xslt] Failed to process /homedir/mcastle/test/build.xml

BUILD FAILED
file:/homedir/mcastle/test/build.xml:5: Fatal error during transformation

mrc


-- 
     Mike Castle      dalgoda@ix.netcom.com      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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message