Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 December 7th, 2011, 10:28 AM
Authorized User
 
Join Date: Oct 2011
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Default Running as part of c# program

Hi,

I have writeen an XSLT transform , which uses the document function to load in config data.
i then run the transform using the c# classes and output the xml to another file.
I have set the XsltSetting to enable documentFunction, and when i run through the debugger (visual studio 2010) then the config file is successfully loaded in and the config items are correctly used.

However, when i run as part of the c# program, the transform successfully runs (ie not error/ exception thrown) but the output is incorrect as the xconfig items have been ignored; its like they are not there

please advise
thanks
 
Old December 7th, 2011, 10:34 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Perhaps if you could us with a sample of the code, as it is virtually impossible to tell from your description what you might be doing wrong.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 7th, 2011, 10:36 AM
Authorized User
 
Join Date: Oct 2011
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Code:
  <xsl:template name = "Lookup_ndf_Currency_from_ConfigFile" >
    <xsl:param name ="curr" />
               
    <xsl:for-each select ="document('config.xml')/FXConnect2FpMLConfig/ndf_currency/currency">
      <xsl:if test = "$curr = @name">
        <xsl:value-of select ="'true'"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

c# code to call the transform

Code:
                        XslCompiledTransform xslt = new XslCompiledTransform();
                        xslt.Load(sXslPath, new System.Xml.Xsl.XsltSettings(true, false), new XmlUrlResolver());


                        using (StringWriter sw = new StringWriter())
                        {
                            xslt.Transform(xri, null, sw);

...
...
 
Old December 7th, 2011, 10:57 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Where is the 'config.xml' file located, in the same directory as the XML input, in the same directory as the stylesheet, are these two in the same directory?
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old December 7th, 2011, 10:58 AM
Authorized User
 
Join Date: Oct 2011
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Default

same directory as the stylesheet
 
Old December 7th, 2011, 11:14 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I can't see anything wrong with your code. You should get an error if it can't find the config, but you wouldn't get an error if the config file it found didn't contain the element you are selecting in the xpath.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
anthonym (December 7th, 2011)
 
Old December 12th, 2011, 08:36 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you show the structure of config.xml?
__________________
Joe
http://joe.fawcett.name/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data View Web Part not running kendo666 BOOK: Beginning SharePoint 2010 Administration: Windows SharePoint Foundation 2010 and Microsoft Sha 2 January 24th, 2011 04:50 AM
Running a program off the network? myurick Visual Basic 2008 Essentials 4 April 3rd, 2008 02:22 PM
Exception in running a program furqanms Java Basics 2 June 21st, 2006 10:39 PM
running another .exe from my program salhabb C++ Programming 1 January 18th, 2006 06:21 AM





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