Groups | Blog | Home
all groups > dotnet xml > october 2003 >

dotnet xml : XSLT Transform problem - Invalid URI: The URI scheme is not valid


Mike
10/30/2003 2:50:11 PM
I'm generating an XSLT document programatically in
VB.Net. I'm then trying to apply that XSLT against a cXML
document to generate my own internally developed XML
document. I'm using RichTextBox controls to dump out the
XSLT, cXML and internal XML.

The following code works fine in Visual Studio 2002.
However, after upgrading to VS 2003, this same code no
longer works

I'm declaring a variable "xslt" as a new XSLTransform.
Dim xslt As XslTransform = New XslTransform

I'm then calling the "Load" method of the "xslt" to load
the XSLT from my RichTextBox control:
xslt.Load(rtbXSLT.Text)

That generates the following exception:
"Invalid URI: The URI scheme is not valid."

Here is an example of a XSLT document that I'm creating
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output encoding="UTF-8" method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:element name="SSXML">
<xsl:element name="Order">
<xsl:value-of select="//OrderRequestHeader/Comments"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

Has anyone else encountered this? If so, what did you do
to fix it? Again, I did not have this problem in VS 2002.
..

anonymous NO[at]SPAM discussions.microsoft.com
10/31/2003 11:59:56 AM
"rtbXSLT" is a rich text box control that contains the
XSLT document (So a user can see it on screen). I'm
trying to pass it's "Text" property - which contains the
actual XSLT - to the XslTransform object.

[quoted text, click to view]
Oleg Tkachenko
10/31/2003 5:38:58 PM
[quoted text, click to view]

So, what rtbXSLT.Text is? Make sure it's valid URI of the stylesheet
document.

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
Oleg Tkachenko
11/1/2003 7:31:09 PM
[quoted text, click to view]

Well, then you're doing it in wrong way and I don't believe it could
work in .NET 1.0. Load(string) method of XslTransform class accepts URI
of the stylesheet to load, not text of the stylesheet, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclassloadtopic2.asp

If you want to load stylesheet as string - use the following pipe:
xslt.Load(new XmlTextReader(new StringReader(rtbXSLT.Text)))
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
AddThis Social Bookmark Button