Hi Harolds,
Does my further response helps a little? If there're anything else we can
help, please feel free to post here.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 45225631
| References: <0C**********************************@microsoft.co m>
<R4**************@TK2MSFTNGXA01.phx.gbl>
<1B**********************************@microsoft.co m>
<mx**************@TK2MSFTNGXA01.phx.gbl>
<ED**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From:
st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Wed, 09 Nov 2005 02:12:09 GMT
| Subject: RE: passing param to xslt styleseet problem
| X-Tomcat-NG: microsoft.public.dotnet.xml
| Message-ID: <IE**************@TK2MSFTNGXA02.phx.gbl>
| Newsgroups: microsoft.public.dotnet.xml
| Lines: 228
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.xml:28906
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Thanks for your reply Harolds,
|
| I think All the .NET objects passed through XsltArgumentList should be
| mapped to the top level parameters because they're just the extension
| provided by .NET and are not really XSLT arguments. For the parameters in
| other nested level, they're template and context sensitive so it's not
| proper for .net arguments to mapping them. Also, I think this is an
| enhancement on the XSLT processing and I've also noticed some other small
| features enchanged in .NET which used to work in 1.x (but is not so
good).
| e.g, the DataView which has specify "Sort" expression will be resorted
| automatically whenever we change any item's "sort" field in it...
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure!
www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | Thread-Topic: passing param to xslt styleseet problem
| | thread-index: AcXkgzZ0EY4/izvuThWeo0UMCyN5TQ==
| | X-WBNR-Posting-Host: 209.142.12.18
| | From: "=?Utf-8?B?SGFyb2xkcw==?=" <ha*****@community.nospam>
| | References: <0C**********************************@microsoft.co m>
| <R4**************@TK2MSFTNGXA01.phx.gbl>
| <1B**********************************@microsoft.co m>
| <mx**************@TK2MSFTNGXA01.phx.gbl>
| | Subject: RE: passing param to xslt styleseet problem
| | Date: Tue, 8 Nov 2005 08:41:05 -0800
| | Lines: 183
| | Message-ID: <ED**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.public.dotnet.xml
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.xml:9246
| | X-Tomcat-NG: microsoft.public.dotnet.xml
| |
| | Thanks Steven for your help, that fixed the problem. Do you know if
| ".NET's
| | xsltArguements should be mapped to the top level parameters" is a
change
| in
| | VS 2005 or was this something that a programmer could do but shouldn't
| have
| | in VS 2003?
| |
| | Thanks again,
| | --
| | Harolds
| |
| |
| | "Steven Cheng[MSFT]" wrote:
| |
| | > Hi Harolds,
| | >
| | > Thanks for your response and the code snippet you provided. From the
| XSLT
| | > file you provided, I found that there has a small difference between
| the
| | > MSDN example and yours. In your XSLT file, you declare the "discount"
| | > parameter under the
| | > <xsl:template ...> element like:
| | >
| | > <xsl:template match="/rss/channel">
| | > <xsl:param name="discount"/>
| | >
| | >
| | > while the MSDN example is directly declaring the parameter under the
| | > <xsl:stylesheet...> root element, like:
| | >
| | > <xsl tylesheet version="1.0"
| | > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| | > <xsl aram name="discount"/>
| | >
| | > Based on my understanding, the .NET's xsltArguements should be mapped
| to
| | > the top level parameters declared in XSLT template. So would you try
| move
| | > the declaration to top level (beneath the stylesheet element) to see
| | > whether this works.
| | >
| | > Thanks,
| | >
| | > Steven Cheng
| | > Microsoft Online Support
| | >
| | > Get Secure!
www.microsoft.com/security
| | > (This posting is provided "AS IS", with no warranties, and confers no
| | > rights.)
| | >
| | >
| | >
| | >
| | > --------------------
| | > | Thread-Topic: passing param to xslt styleseet problem
| | > | thread-index: AcXkBFwDSdLkrcxiQm+X0Gtu5tOc0g==
| | > | X-WBNR-Posting-Host: 67.181.53.149
| | > | From: "=?Utf-8?B?SGFyb2xkcw==?=" <ha*****@community.nospam>
| | > | References: <0C**********************************@microsoft.co m>
| | > <R4**************@TK2MSFTNGXA01.phx.gbl>
| | > | Subject: RE: passing param to xslt styleseet problem
| | > | Date: Mon, 7 Nov 2005 17:33:03 -0800
| | > | Lines: 94
| | > | Message-ID: <1B**********************************@microsoft.co m>
| | > | MIME-Version: 1.0
| | > | Content-Type: text/plain;
| | > | charset="Utf-8"
| | > | Content-Transfer-Encoding: 7bit
| | > | X-Newsreader: Microsoft CDO for Windows 2000
| | > | Content-Class: urn:content-classes:message
| | > | Importance: normal
| | > | Priority: normal
| | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | > | Newsgroups: microsoft.public.dotnet.xml
| | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| | > | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.xml:9239
| | > | X-Tomcat-NG: microsoft.public.dotnet.xml
| | > |
| | > | Below is a test example, you see in the output.txt that the param
| | > $discount
| | > | value is empty though the value is being set to "10" and passed to
| | > transform.
| | > |
| | > | C# Source:
| | > | XsltArgumentList xsltArgList = new XsltArgumentList();
| | > | xsltArgList.AddParam("discount", "", "10");
| | > |
| | > | XmlDocument testXML = new XmlDocument();
| | > | testXML.Load("c:\\temp\\feed.xml");
| | > | XslCompiledTransform tra = new
XslCompiledTransform(true);
| | > | tra.Load("C:\\temp\\items.xslt");
| | > | using (TextWriter streamWriter =
| | > | new StreamWriter("c:\\temp\\output.txt"))
| | > | tra.Transform(testXML, xsltArgList,streamWriter);
| | > |
| | > | feed.xml:
| | > | <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
| | > | <channel>
| | > | <title>MSDN Subscriber Downloads</title>
| | > | <link>http://msdn.microsoft.com/subscriptions/</link>
| | > | <description>Products recently posted to MSDN Subscriber
| | > | Downloads.</description>
| | > | <dc:language>en-us</dc:language>
| | > | <ttl>1440</ttl>
| | > | <image>
| | > | <title>MSDN Subscriber Downloads</title>
| | > |
| | > |
| | >
|
<url>
http://msdn.microsoft.com/library/to...ers/msdn_masth
| | > ead_ltr.gif</url>
| | > | <link>http://msdn.microsoft.com/subscriptions/</link>
| | > | </image>
| | > | <item>
| | > | <title>Commerce Server 2002 Enterprise Edition (Multiple
| | > | Languages)</title>
| | > | <dc:date>2005-11-03T16:00:00-08:00</dc:date>
| | > | <description>
| | > | As part of the Microsoft Windows Server System, Commerce Server
2002
| is
| | > an
| | > | extensible solution that enables organizations to rapidly deploy
| | > personalized
| | > | portals. Commerce Server 2002 provides a powerful set of
capabilities
| for
| | > | non-transaction-based sites including user profiling, content
| targeting,
| | > | multi-language, and advanced business analytics.
| | > | </description>
| | > | </item>
| | > | <item>
| | > | <title>Windows XP Media Center Diagnostics Kit v3.0 (English)
| | > </title>
| | > | <dc:date>2005-11-03T16:00:00-08:00</dc:date>
| | > | <description>
| | > | A set of tools to evaluate readiness of Windows XP Media Center
| Edition
| | > PCs
| | > | and troubleshoot video quality issues. The Media Center Diagnostics
| Kit
| | > | includes tools that allow users to explore PC configuration
settings,
| | > test
| | > | for a variety of video playback capabilities and evaluate video
| quality
| | > for
| | > | color and grayscale accuracy.
| | > | </description>
| | > | </item>
| | > | <item>
| | > | <title>Windows XP Media Center Edition 2005 Update Rollup 2
SDK
| | > | (English) </title>
| | > | <dc:date>2005-11-03T16:00:00-08:00</dc:date>
| | > | <description>
| | > | The Media Center SDK is designed to help developers create
| applications
| | > and
| | > | software components that take advantage of features provided by
| Windows
| | > XP
| | > | Media Center Edition.
| | > | </description>
| | > | </item>
| | > | </channel>
| | > | </rss>
| | > |
| | > | Items.xslt:
| | > | <?xml version="1.0" encoding="UTF-8" ?>
| | > | <xsl:stylesheet version="1.0"
| | > | xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| | > | <!--xmlns:msxsl="urn:schemas-microsoft-com:xslt"
| | > | xmlns:dc="http://purl.org/dc/elements/1.1/">-->
| | > |
| | > | <xsl:output method="html" omit-xml-declaration="yes" />
| | > |
| | > | <xsl:template match="/rss/channel">
| | > | <xsl:param name="discount"/>
| | > | <xsl:for-each select="item">
| | > | <li>
| | > | <a>
| | > | <xsl:attribute name="href">discount.aspx?ID=<xsl:number
| | > | value="position()" />
| | > | </xsl:attribute>discount=<xsl:value-of select="$discount"
/>
| | > |
| | > | </a>
| | > | </li>
| | > | </xsl:for-each>
| | > | </xsl:template>
| | > | </xsl:stylesheet>
| | > |
| | > | output.txt:
| | > | <li><a href="discount.aspx?ID=1">discount=</a></li>
| | > | <li><a href="discount.aspx?ID=2">discount=</a></li>
| | > | <li><a href="discount.aspx?ID=3">discount=</a></li>
| | > |
| | >
| | >
| |
|
|