xsl-list
[Top] [All Lists]

Re: Can someone help me understand why this isn't working?

2005-01-20 09:21:58
Hi David;

I am trying this in my actual production system (the code I posted before
was an example to help with my understanding). I get the following error:

 SystemID: http://www.dcarlisle.demon.co.uk/htmlparse.xsl; Line#: 118;
Column#: 76 javax.xml.transform.TransformerException: Extra illegal tokens:
''[^'', '']*'', ''|\c+))?\s*''

This is the apply template line:

<xsl:apply-templates
select="d:htmlparse(string(DATA/VERSION/ITEM[(_at_)NAME=$textname][1]),'',true())
/node()"/>

I am using the xalan processor. Is this a problem, does this require saxon?

Thanks,

Luke




----- Original Message ----- 
From: "David Carlisle" <davidc(_at_)nag(_dot_)co(_dot_)uk>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, January 20, 2005 10:30 AM
Subject: Re: [xsl] Can someone help me understand why this isn't working?




If you can use XSLT2 (eg saxon8) one option is to parse within xslt.

eg the following implements your test example of converting the
&lt;P&gt;... to
an em element rather than the fo:block you really want, to generate fo,
just replace <em>  final template by the obvious thing.


<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:d="data:,dpc"
exclude-result-prefixes="d">
<xsl:import href="http://www.dcarlisle.demon.co.uk/htmlparse.xsl"/>

<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>Today's greeting</title>
</head>
<body>
<xsl:apply-templates
select="d:htmlparse(string(greeting[1]),'',true())/node()"/>
</body>
</html>
</xsl:template>

<xsl:template match="p"> <em><xsl:apply-templates/></em> </xsl:template>
</xsl:stylesheet>


on an input of:

<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet
type="text/xsl"
href="hello.xsl"?>
<greeting>&lt;P&gt;Hello, world!&lt;/P&gt;</greeting>

it produces:



$ java -jar saxon8.jar  h.xml h.xsl
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

      <title>Today's greeting</title>
   </head>
   <body><em>Hello, world!</em></body>
</html>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--