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 October 22nd, 2006, 11:58 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Output from XSLCompiledTransform to a ContentPlac

Hi,

I'm new to ASP.NET



I'm building a website, I want to use xslCompiledTransform with master pages.
My masterpage has ContentPlaceHolder1

 I'm using this line to transform XML file. (In page_load)

   xslt.Transform("Products.xml", argumentList, Response.Output)


My problem is, I want the output to appear INSIDE the ContentPlaceHolder1 in masterpage.

However, when I used the above code, results appear ABOVE everything in masterpage.


What do I need to do to get the results into the ContentPlaceHolder1 ?



Thanks.

 
Old October 25th, 2006, 07:18 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Question:- How do I get the results of the XSLCompiledTransform.Transform method into an XML.XMLreader object?

Hi,
I ran into following situation when migrating my framework 1.1 codes to 2.0:
Old situation (.net v1.1):
==========xslt file=============
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xslt.html#strip">
<xsl:output method="text" version="1.0"
encoding="UTF-8" indent="no"/>
<xsl:variable name="SelectedStateId" />
<xsl:template match="Jurisdictions">
<xsl:param name="iSelectedStateId" select="$SelectedStateId" />
&lt;script type="text/javascript"&gt;
    //Array for List items
    //Xsl-Param:SelectedStateId: <xsl:value-of select="$iSelectedStateId" />
    var tmpCityArr = new Array(3);
    tmpCityArr[0] =
    <xsl:for-each select="Country[JurisId=50001]">
    new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />'<xsl:for-each select="State">,
        new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />'<xsl:if test="JurisId = $SelectedStateId"><xsl:for-each select="City">,
            new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />')
    </xsl:for-each></xsl:if>)</xsl:for-each></xsl:for-each>
    );
    tmpCityArr[1] =
    <xsl:for-each select="Country[JurisId=50002]">
    new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />'<xsl:for-each select="State">,
        new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />'<xsl:if test="JurisId = $SelectedStateId"><xsl:for-each select="City">,
            new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />')
    </xsl:for-each></xsl:if>)</xsl:for-each></xsl:for-each>
    );
    tmpCityArr[2] =
    new Array('International|' <xsl:for-each select="Country[JurisId != 50001 and JurisId != 50002]">,
        new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />'<xsl:if test="JurisId = $SelectedStateId"><xsl:for-each select="State">,
            new Array('<xsl:value-of select="JurisName" />|<xsl:value-of select="JurisId" />')
    </xsl:for-each></xsl:if>)</xsl:for-each>
    );
&lt;/script&gt;
</xsl:template>
</xsl:stylesheet>
===================================

==============aspx page codebehind========
private XmlReader __prepareXmlData(IXPathNavigable inputXml, string xslTransform, object[] xslParams )
        {
 //get transform
             XslTransform xt = new XslTransform();
             xt.Load(Server.MapPath(xslTransform));
             XsltArgumentList xslArgs = new XsltArgumentList();
             if (null != xslParams)
             {
                 for (int i = 0; i < xslParams.Length; i++)
 xslArgs.AddParam((string)xslParams[i], tring.Empty, xslParams[++i]);
              }
             //transform string
             XmlUrlResolver resolver = new XmlUrlResolver();
   resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;
      XmlReader xr = xt.Transform(inputXml, xslArgs, resolver);
Retrurn(xr);
}

=============================
Facts in the ASP 2.0 world are:
1 Now, new and shiny XslCompiledTransform class doesn't support this feature anymore, transformation output is now only Stream, TextWriter or XmlWriter
2) XslTransform objects (class) is obsolete as well.
Note: for the above method we are Storing the Xslt file in resources is fine. When you need the file the easiest solution is to write the resource to file and use the XslCompiledTransform.Load (String) where String is path of file.
All above code is working fine in .net 1.1 but it’s not working in .net 2.0.

Hope you can help?
Thanks.
best regards
Mahesh











Similar Threads
Thread Thread Starter Forum Replies Last Post
Output to text bonekrusher XSLT 4 November 25th, 2007 01:06 PM
tell me the output abdul_owiusa C# 3 May 10th, 2007 04:25 AM
Output should appear in Mozila instead of IE anujrathi ASP.NET 1.0 and 1.1 Professional 2 August 30th, 2006 09:47 AM
Output Difference wolftrap1 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 January 4th, 2004 05:44 PM
how to get this output? Haroldd SQL Language 2 July 16th, 2003 07:24 AM





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