473,394 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

.NET , XML , XSL -> XsltArgumentList : Question ?

Hello,

I have a page in .net (DEFAULT.ASPX), i load a XmlDocument, and a
XslTransform to Add a XsltArgumentList (with the param : urlPage), and send
all to a <asp:xml> in the page.

The <asp:xml> is good with xml and xsl, but the param is not fill with the
value ?

Do you have a solution ??? Thanx

---
DEFAULT.ASPX :
<script language="C#" runat="server">

private void Page_Load(object sender, System.EventArgs e)

{

String xmlPath = Server.MapPath("/data/page.xml") ;

String xslPath = Server.MapPath("/xsl/i_infoPage.xsl") ;

String strUrlPage = "/default.aspx";

String xpathPage = "page[url='" + strUrlPage + "']";
// Nouvo XmlDoc pour l'affichage des Infos de Page

XmlDocument xmldocInfo = new XmlDocument();

xmldocInfo.Load(xmlPath);

XslTransform xsltInfo = new XslTransform();

xsltInfo.Load(xslPath);

// Crée un Arg pour le passage en Xslt du Composant Asp:Xml

XsltArgumentList argsInfo = new XsltArgumentList();

argsInfo.AddParam("urlPage","", "'Nico'");

// Réalise la transformation

xsltInfo.Transform(xmldocInfo, argsInfo);
// Source Xml et Xslt pour le Composant AspXml

aspxmlInfo.Document = xmldocInfo;

aspxmlInfo.Transform = xsltInfo;

}

</script>

<asp:xml ID="aspxmlInfo" runat="server"></asp:xml>

DEFAULT.ASPX : FIN

---

I_INFOPAGE.XSL :

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="html" indent="no" />

<xsl:param name="urlPage" />

<xsl:template match="/">

<xsl:apply-templates select="//page[userCreation=$urlPage]" />

</xsl:template>

<xsl:template match="page">

<table class="mainTable" border="0" cellpadding="0" cellspacing="0"
align="center" bgcolor="#FFFFFF">

<tr align="left" valign="top">

<td class="infoPage" style="padding-left: 209px"><xsl:value-of
select="userMiseajour" /> - <xsl:value-of select="dateMiseajour" /></td>

<td width="200" align="right" class="infoPage" style="padding-right:
8px">vu: <xsl:value-of select="vu" /></td>

</tr>

</table>

</xsl:template>

</xsl:stylesheet>

I_INFOPAGE.XSL :FIN

Nov 12 '05 #1
1 1937
NicoAgenci wrote:

private void Page_Load(object sender, System.EventArgs e)

{

String xmlPath = Server.MapPath("/data/page.xml") ;

String xslPath = Server.MapPath("/xsl/i_infoPage.xsl") ;

String strUrlPage = "/default.aspx";

String xpathPage = "page[url='" + strUrlPage + "']";
// Nouvo XmlDoc pour l'affichage des Infos de Page

XmlDocument xmldocInfo = new XmlDocument();

xmldocInfo.Load(xmlPath);

XslTransform xsltInfo = new XslTransform();

xsltInfo.Load(xslPath);

// Crée un Arg pour le passage en Xslt du Composant Asp:Xml

XsltArgumentList argsInfo = new XsltArgumentList();

argsInfo.AddParam("urlPage","", "'Nico'");

// Réalise la transformation

xsltInfo.Transform(xmldocInfo, argsInfo);
Well, above line is superfluous. Technically here you are starting XSL
transformation and not using its result. asp:xml control will do
transformation for you, that's its the only function. You only need to
provide source document, xsl stylesheet and optional parameters.
// Source Xml et Xslt pour le Composant AspXml

aspxmlInfo.Document = xmldocInfo;

aspxmlInfo.Transform = xsltInfo;


Here is how you can provide parameters to asp:xml control:

aspxmlInfo.TransformArgumentList = argsInfo;

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anders Borum | last post by:
Hello! I would like to request a new method on the XsltArgumentList class, allowing developers to check the presense of a key/value pair. If you try to add a key/value pair that has already been...
5
by: Tim Menninger | last post by:
I have seen the postings about passing XML into an XSL transformation. The problem is that I cannot use any XPath navigation in the XSL that won't generate an error. If I use <xsl:copy-of...
5
by: Luke Vogel | last post by:
Hi all, Probably a really basic question, but I cant find an answer ... I have an xml file of books something like: <product> <isbn>0-735-61374-5</isbn> <title>Microsoft Visual Basic Step By...
4
by: Paul | last post by:
Hi all. This one is really getting to me now, I'm using the <asp:xml web server control and I'm trying to use the XsltArgument list to add a custom class so that I can do some formatting in the...
1
by: chris yoker via DotNetMonster.com | last post by:
hiya, I add new nodes to an xmlDoc. I want to add "innerText" to every newly-created node. current XML file <code> <rows> <row> <PRODUCT-TYPE>bike</PRODUCT-TYPE>...
0
by: Rick Walsh | last post by:
I am using the following code to export a dataset via xml and xsl to html: ------------------------------------------------------------- .. .. .. Dim dataDoc as new...
0
by: Hulk | last post by:
I have problems passing parameters from C# application to XSL file and doing a transformation. My code is below.: XsltArgumentList xslArg = new XsltArgumentList(); String key =...
1
by: Sam | last post by:
I am working with .Net 2.0. I found a 2002 posting with this sample code of how to send a node-set into a XSLT transformation: string xml = @"<foo><bar>The Test</bar></foo>"; string xsl =...
0
by: MedIt | last post by:
Hi all, Help needed in the xsl transformation in c# while passing with arguments. I am trying to transform an xml programtically (c#), while passing with two parameters using the XsltArgumentList...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.