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

February 17th, 2010, 04:00 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
|
|
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.
|
|

February 17th, 2010, 06:13 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

February 17th, 2010, 06:40 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
|
|
So saxon parse can do this right?
|
|

February 17th, 2010, 07:38 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

February 17th, 2010, 07:52 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
|
|
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?
|
|

February 17th, 2010, 07:57 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

February 17th, 2010, 08:33 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
|
|
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?
|
|

February 17th, 2010, 08:44 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

February 17th, 2010, 09:09 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
|
|
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()
|
|

February 17th, 2010, 10:00 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
>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
|
|
 |