Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML 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 February 18th, 2005, 11:27 PM
Authorized User
 
Join Date: Nov 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT in VC++.NET 7.0: Output in Web Browser

I have carefully studied (1) Chapter 4, XSLT of "Beginning XML", 2nd Edition by D. Hunter, et. al. and (2) Chapter 21, Transforming XML of Microsoft Visual C++ .NET Step by Step, by J. Templeman & A. Olsen. I did "Build" and executed the attached "CppXsl" program of (2) on my VC++ .NET (7.0) - Windows XP Pro PC and I got the following:
"Usage: CppXsl xml-file stylesheet
 Press any key to continue" on my console.
But I do not know how to extract the data of 'Volcanoes' from the XML file and merge with HTML to create the output in the web browser. Please help and advise me how I can get the output in my web browser.
Thanks in advance,
SHC
/////--CppXsl.cpp--/////
// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include "stdafx.h"

#using <mscorlib.dll>
#using <System.xml.dll>

using namespace System;
using namespace System::Xml;
using namespace System::Xml::XPath;
using namespace System::Xml::Xsl;


// This is the entry point for this application
#ifdef _UNICODE
int wmain(void)
#else
int main(int argc, char* argv[])
#endif
{
    // Check for required arguments
    if (argc < 3)
    {
        Console::WriteLine(S"Usage: CppXsl xml-file stylesheet");
        return -1;
    }

    String* path = new String(argv[1]);
    String* xslpath = new String(argv[2]);

    try
    {
        // Create the XmlDocument to parse the file
        XmlDocument* doc = new XmlDocument();

        // Load the file
        doc->Load(path);

        // Create the navigator and position it
        XPathNavigator* nav = doc->CreateNavigator();
        nav->MoveToRoot();

        // Create the XslTransform and load it
        XslTransform* xslt = new XslTransform();
        xslt->Load(xslpath);

        // Create a writer for output
        XmlTextWriter* xtw = new XmlTextWriter(Console::Out);
        xtw->Formatting = Formatting::Indented;

        // Do the transformation
        xslt->Transform(nav, 0, xtw);





    }
    catch(Exception* pe)
    {
        Console::WriteLine(pe->Message);
    }

    return 0;
}

Scott Chang
__________________
Scott Chang





Similar Threads
Thread Thread Starter Forum Replies Last Post
The output of ASP.NET driven web pages Miko2 ASP.NET 2.0 Basics 19 September 29th, 2007 11:19 PM
ASP.Net Web Server Controls inside XSLT russmack XSLT 2 December 14th, 2006 10:02 AM
Problem with Web Browser control in vc++ sureshkumarct Visual C++ 0 May 29th, 2006 04:01 AM
Opening the formated output in browser msrnivas General .NET 1 January 18th, 2005 08:29 AM





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