|
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
|
|
|
May 21st, 2006, 08:32 PM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
do you have a link? thanks
|
May 22nd, 2006, 08:36 AM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am doing transformation on .NET 1.1 using XslTransform with XPathDocument and xslstring will it do the same thing?
using (MemoryStream mStream = new MemoryStream())
{
XslTransform xsl = new XslTransform();
xsl.Load(XslFile);
//zk XsltArgumentList xslarg = new XsltArgumentList();
//zk Xslarg.AddParam("pageid", "", pageId);
xsl.Transform(XPDoc, null, mStream, null);
thanks
|
May 22nd, 2006, 09:03 AM
|
|
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
I don't understand the question. You want to know if X does the same as Y, but I don't know what X and Y are.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
May 22nd, 2006, 09:39 AM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi let me rephrase the question I am using XslTransform from .NET 1.1 to transform xml and xsl into server controls will the XsltTransformer from saxon do the same job?
|
May 22nd, 2006, 10:04 AM
|
|
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Saxon supports XSLT 2.0 rather than XSLT 1.0, but if you put a 1.0 stylesheet through it you're very unlikely to hit any incompatibilities (unless you go out of your way to find them). You might however hit some aspects of the language that are implementation-defined or that have been quirkily implemented by Microsoft, for example System.Xml tends to accept a Windows filename containing backslashes in places where the W3C specs require a URI.
Saxon doesn't support the same API as .NET System.Xml.Xsl (it can't, because it's defined using concrete classes rather than interfaces). But it shouldn't be too much work to convert.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
May 22nd, 2006, 10:15 AM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I Am trying to run this example I found in the internet
String sourceUri = Server.MapPath("saxon.xml");
String xsltUri = Server.MapPath("saxon.xslt");
FileStream sXml = File.OpenRead(sourceUri);
FileStream sXsl = File.OpenRead(xsltUri);
Processor processor = new Processor();
DocumentBuilder builder = processor.NewDocumentBuilder();
Uri sUri = new Uri(sourceUri);
builder.BaseUri = sUri;
XdmNode input = builder.Build(sXml);
XsltTransformer transformer = processor.NewXsltCompiler().Compile(sXsl).Load();
transformer.InitialContextNode = input;
Serializer serializer = new Serializer();
serializer.SetOutputWriter(Response.Output);
transformer.Run(serializer);
xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="message">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Hello">
Hello <xsl:value-of select="." />
</xsl:template>
</xsl:transform>
and xml
<?xml version="1.0" encoding="utf-8"?>
<message>
<Hello>Saxon on .NET!</Hello>
</message>
and its giving me error on
XsltTransformer transformer = processor.NewXsltCompiler().Compile(sXsl).Load();
"Object reference not set to an instance of an object."
I have reference
using Saxon.Api;
why is this sample not working? thanks
|
May 22nd, 2006, 10:50 AM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I got this..thanks...
|
May 23rd, 2006, 04:06 AM
|
|
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
You should really be asking a Saxon-specific question like this on the saxon-help list or forum at sourceforge.net.
I think the answer is probably that the BaseURI property on the XsltCompiler has not been set. This needs a better diagnostic!
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
May 23rd, 2006, 02:32 PM
|
Authorized User
|
|
Join Date: May 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok thanks
|
|
|