[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: Can someone help me understand why this isn't working?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Jan 2005 15:30:19 GMT
someone who isnt me
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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.