Wrox Programmer Forums
|
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 September 20th, 2007, 06:33 AM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT

i want to retrieve datas from sql in xml format and display using xslt.... for example when selcting particular name their details should come in grid..........
but using XML & XSLT

can anyone help me out....
or can u give me any samples of this kind


 
Old September 20th, 2007, 08:32 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you have SQL Server then you can use either a FOR XML query or, if you have version 2005, one of the XML data type methods such as query(). The transform will need to take place on the middle-tier or client, SQL Server has no direct XSLT capabilities. Oracle has XSQL, which allows retrieval and transformation of XML produced from realational SQL queries.

--

Joe (Microsoft MVP - XML)
 
Old September 20th, 2007, 08:55 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You've described a complex application in three lines of text, and said "please design it for me". Sorry, that kind of question doesn't work. You'll have to be far more precise about which part of the problem is causing you difficulty.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 20th, 2007, 10:23 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi, I think your question is more related to a SQL Server forum, however here is some code to get you started. This assumes you are storing the XML as XML datatype:

Code:
' transform SQL xml and VIEW
        Try

    Dim myconnection As Data.SqlClient.SqlConnection
            myconnection = New Data.SqlClient.SqlConnection()
            myconnection.ConnectionString = _
            ConfigurationManager.ConnectionStrings("MYCMSConnectionString5").ConnectionString
    Dim strSQL As String = "SELECT xmldata FROM MYTABLE"
    Dim dbComm As New Data.SqlClient.SqlCommand(strSQL, myconnection)

            myconnection.Open()

    Dim myXR = dbComm.ExecuteXmlReader()

    Dim sb As New StringBuilder()
            While myXR.read()
                sb.Append(myXR.readouterxml())
            End While

    Dim xml As String = sb.ToString()

    Dim finxml As String = sb.ToString()
    Dim xmldoc As New XmlDocument
            xmldoc.LoadXml(xml)

    Dim stWrite As StringWriter = New StringWriter()
    Dim xslt As New XslCompiledTransform()

            xslt.Load(Server.MapPath("xslt/myxslt.xslt"))

            xslt.Transform(xmldoc, Nothing, stWrite)
            Response.Write(stWrite.ToString())


            dbComm.Dispose()
        Catch ex As Exception
            Response.Write(Err.Description)
        End Try





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating XSLT with XSLT stonis XSLT 3 April 1st, 2008 08:17 PM
General XSLT Questions in the XSLT Forum jminatel BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 0 March 31st, 2008 07:50 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM
xslt with an xslt outputfile alleycat XSLT 4 February 20th, 2006 09:56 AM





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