Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2010, 04:00 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default escaped HTML inside XML

I have xhtml inside xml. Its escaped like <br/>

I am using XSLT 1.0 and xalan

I want to apply templates to this html code

I remember doing it before with saxon:parse but I can't use saxon at the moment.

I have to transform the html into code in the FO namespace. I know how to do that part. Its just applying templates to the escaped mark up.

Any help is greatly appreciated. Regards, John.
 
Old February 17th, 2010, 06:13 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

First, whoever escaped the markup did so in order to prevent you doing this. They were saying "don't treat this as markup!" which makes life difficult for anyone who wants to treat it as markup. So your first step should be to try and persuade them that they are making your life unnecessarily difficult.

If you can't get them to change their ways, then you need to unescape the markup, or, to put it another way, to extract the data as a string and then put this string through a parser. If your processor doesn't provide an extension function to do this then you will have to write your own.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 17th, 2010, 06:40 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

So saxon parse can do this right?
 
Old February 17th, 2010, 07:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Yes. (--------- short messages are not allowed on this forum -------)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 17th, 2010, 07:52 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

When I run the XSL through java

Error on line 118 of temp.xsl:

net.sf.saxon.trans.XPathException: Cannot find a matching 1-argument function named {net.sf.saxon}parse()

What do you think this is from?
 
Old February 17th, 2010, 07:57 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Firstly, the namespace is "http://saxon.sf.net/", not "net.sf.saxon".

Secondly, you need Saxon-PE or Saxon-EE to use Saxon extension functions.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 17th, 2010, 08:33 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

Error on line 118 of temp.xsl:
Cannot find a matching 1-argument function named {saxon.sf.net}parse()

I downloaded and evaluation copy of saxon9pe and I still get this error.

<xsl:value-of select="system-property('xsl:vendor')"/> gives this

SAXON 9.2.0.6 from Saxonica

I am running all of this under tomcat but I can't seem to get the extension functions working...

Any ideas?
 
Old February 17th, 2010, 08:44 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

How are you invoking Saxon?

For example, if you use the JAXP interface you need to use com.saxonica.config.EnterpriseTransformerFactory rather than net.sf.saxon.TransformerFactoryImpl to get Saxon-EE functionality.

Underlying the API, the important thing is that whatever interfaces you use, you need to be running under the control of a ProfessionalConfiguration or EnterpriseConfiguration rather than under a plain net.sf.saxon.Configuration.

The evidence from the xsl:vendor output isn't actually useful.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 17th, 2010, 09:09 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

System.setProperty("javax.xml.transform.Transforme rFactory", "com.saxonica.config.ProfessionalTransformerFactor y");


Is this all i need in my java code?

Because I still get the error - net.sf.saxon.trans.XPathException: Cannot find a matching 1-argument function named {saxon.sf.net}parse()
 
Old February 17th, 2010, 10:00 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>Cannot find a matching 1-argument function named {saxon.sf.net}parse()

It looks as if you are still using the wrong namespace.

You'll need to give more information about what you are doing: preferably a short but complete repro of the problem.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Escaped CDATA - outputting HTML mattisimo XSLT 8 February 3rd, 2010 11:01 AM
Accessing and using an ActiveX from inside a HTML page hosted inside a WebBrowser con adyrotaru C# 2005 2 June 25th, 2009 04:21 PM
html part inside xml RoeZ XSLT 3 November 28th, 2007 08:18 AM
Rendering HTML inside XML through XSL - HELP !!! jilly XSLT 6 May 23rd, 2007 10:36 AM
viewing xml inside an html file Tomi XML 1 August 2nd, 2006 05:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.