Results 1 to 6 of 6

Thread: [RESOLVED] [1.0/1.1] Xml And Xslt

  1. #1

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Resolved [RESOLVED] [1.0/1.1] Xml And Xslt

    I am trying to just make a basic class to read an xml file and apple the xslt but I keep getting an System.Xml.Xsl.XsltCompileException on the transform load event.

    I have looked up what causes this error and it says that there is a problem in the xslt file, but there doesn't seem to be a problem with the xslt file that I can find.

    Can someone help me identify the problem? Thanks

    Code:
    XPathDocument xpd = new XPathDocument(@"E:\Visual Studio Projects\XmlWithXslt\XmlWithXslt\xml.xml");
    XslTransform xlst = new XslTransform();
    XPathNavigator xpn = xpd.CreateNavigator();
    
    XmlTextWriter writer = new XmlTextWriter(@"E:\Visual Studio Projects\XmlWithXslt\XmlWithXslt\result.xml", null);
    			
    xlst.Load(xpn);
    
    xlst.Transform(xpd, null, writer);
    writer.Close();
    StreamReader stream = new StreamReader (@"E:\Visual Studio Projects\XmlWithXslt\XmlWithXslt\result.xml");
    Console.Write("**This is result document**\n\n");
    Console.Write(stream.ReadToEnd());;
    XSLT
    Code:
    <?xml version="1.0"?>
    <xsl:sytlesheet version="1.0"
    	 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    	<xsl:template match="PERIODIC_TABLE">
    		<HTML>
    			<xsl:apply-templates/>
    		</HTML>
    	</xsl:template>
    	
    	<xsl:template match="ATOM">
    		<P>
    			<xsl:apply-templates/>
    		</P>
    	</xsl:template>
    </xsl:sytlesheet>
    XML
    Code:
    <?xml version="1.0"?> 
    <?xml-stylesheet type="application/xml" href="style.xsl"?>
    <PERIODIC_TABLE>
    	<ATOM STATE="GAS">
    		<NAME>Hydrogen</NAME>
    		<SYMBOL>H</SYMBOL>
    		<NUMBER>1</NUMBER>
    		<WEIGHT>1.00794</WEIGHT>
    	</ATOM>		    
    </PERIODIC_TABLE>

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [1.0/1.1] Xml And Xslt

    When it matches ATOM, what template does it apply?

  3. #3
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: [1.0/1.1] Xml And Xslt

    xsl:sytlesheet


  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [1.0/1.1] Xml And Xslt

    Lol :d

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [1.0/1.1] Xml And Xslt

    Quote Originally Posted by Jumpercables
    apple the xslt
    Spelling isn't exactly your forté, is it?

  6. #6

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [1.0/1.1] Xml And Xslt

    Quote Originally Posted by penagate
    Spelling isn't exactly your forté, is it?
    Spelling is fun!

    I needed to apple the correct template.

    Thanks...

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width