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

RE: RE: VB 2008 Passing Parameter to XSLT 2.0

Subject: RE: RE: VB 2008 Passing Parameter to XSLT 2.0
From: "Knight, Michel" <michel.knight@xxxxxxxx>
Date: Fri, 10 Jul 2009 12:07:50 -0400
RE: RE:  VB 2008  Passing Parameter to XSLT 2.0
Thx for the info I've remove everything and only kept the section that
you've mention.

So the code look like this and it goes and execute, but it doesn't pass
the parameters, any ideal what's missing?
I'm testing with 2 parameters.
Do I need to pass more parameter to-->transformer.Run(serializer), or is
it at the XSLT level that I'm not retrieving properly?

----------------------- VB Code
    Private Function ParseFile(ByVal source As String, ByVal target As
String) As ParseResponse
        Dim response As New ParseResponse()
        Dim memStream As New MemoryStream()
        Dim processor As New Processor()
        Dim xhtmlDoc As New XmlTextReader(source)
        Dim xslDoc As New XmlTextReader(myParseProperties.XSL)

        Dim input As XdmNode =
processor.NewDocumentBuilder().Build(xhtmlDoc)
        Dim transformer As XsltTransformer =
processor.NewXsltCompiler().Compile(xslDoc).Load()


        transformer.SetParameter(New QName("", "", "target"), New
XdmAtomicValue("A Value"))
        transformer.InitialContextNode = input
        transformer.SetParameter(New QName("", "", "target1"), New
XdmAtomicValue(target))

        Dim serializer As New Serializer()

        serializer.SetOutputFile(target)
        'serializer.SetOutputWriter(Console.Out)

        response.SourceFile = source
        response.TargetFile = target
        response.Timestamp = Now()

        Try
            transformer.Run(serializer)

            response.Message = "Successfully parsed and transformed"
        Catch ex As Exception
            response.Message = "Error: " & ex.Message
        End Try

        Return response
    End Function
-------------- XSLT 2.0 code
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xhtml" >
<xsl:output method="xml" indent="yes" encoding="windows-1252"
exclude-result-prefixes="xhtml" ></xsl:output>
<xsl:strip-space elements="*"/>

<xsl:variable name="target"   select="target" />
<xsl:variable name="target1"   select="target1" />


<xsl:template match="xhtml:html" exclude-result-prefixes="xhtml" >

    <root>
    Start
    <xsl:value-of select="$target"></xsl:value-of>
    <xsl:copy-of select="$target1"></xsl:copy-of>
    End
  </root>
  </xsl:template>
</xsl:stylesheet>

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.