[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Transforming Xslt File prior to transformation.

johndoe@driver.net

6/3/2004 9:37:00 PM

In ASP 3.0 and MSXMLHTTP2 we would load Our Xslt file as an XmlDocument. We
then merely had to set the language and we could then execute Expath queries
against the document. This is especially useful for performing actions upon
Xslt Nodes that cannot be done through variables. After modifying the
Document via DOM one could then Transform it agianst the Xml and get the
expected results.

I am looking for a way to have this same functionality in C#/ASP.NET. I know
how to use the XsltTransform Below is sample asp 3.0 code - the
functionality that i am attempting to duplicate in C# is the
set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
Where i grab all the sort nodes as XmlNodes that are modifyable



Below is the ASP 3.0 code
I am having difficulty seeing exactly how this can be achieved with
' Create XML and XSLT Document
Set xmlDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
Set xslDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
' Load up XML Data
xmlFile = Server.MapPath("TheData.xml")
xmlDoc.async = false
xmlDoc.load(xmlFile)
' Load up XSLT Value
xslFile = Server.MapPath("OurXsltFile.xsl")
xslDoc.async = false
xslDoc.load(xslFile)
' xslDoc.setProperty
"SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform&... '
force it to use hack
xslDoc.setProperty "SelectionLanguage","XPath"

set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
' Code to modify the nodeList setting attributes we need


4 Answers

johndoe@driver.net

6/3/2004 9:52:00 PM

0

Subject should actually read
Modifying Xslt Nodes priot to Transformation



<johndoe@driver.net> wrote in message
news:uSKlXKaSEHA.1048@tk2msftngp13.phx.gbl...
> In ASP 3.0 and MSXMLHTTP2 we would load Our Xslt file as an XmlDocument.
> We then merely had to set the language and we could then execute Expath
> queries against the document. This is especially useful for performing
> actions upon Xslt Nodes that cannot be done through variables. After
> modifying the Document via DOM one could then Transform it agianst the Xml
> and get the expected results.
>
> I am looking for a way to have this same functionality in C#/ASP.NET. I
> know how to use the XsltTransform Below is sample asp 3.0 code - the
> functionality that i am attempting to duplicate in C# is the
> set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
> Where i grab all the sort nodes as XmlNodes that are modifyable
>
>
>
> Below is the ASP 3.0 code
> I am having difficulty seeing exactly how this can be achieved with
> ' Create XML and XSLT Document
> Set xmlDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
> Set xslDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
> ' Load up XML Data
> xmlFile = Server.MapPath("TheData.xml")
> xmlDoc.async = false
> xmlDoc.load(xmlFile)
> ' Load up XSLT Value
> xslFile = Server.MapPath("OurXsltFile.xsl")
> xslDoc.async = false
> xslDoc.load(xslFile)
> ' xslDoc.setProperty
> "SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform&... '
> force it to use hack
> xslDoc.setProperty "SelectionLanguage","XPath"
>
> set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
> ' Code to modify the nodeList setting attributes we need
>
>


johndoe@driver.net

6/3/2004 10:36:00 PM

0

I think i have it sorted


<johndoe@driver.net> wrote in message
news:OjgHiiaSEHA.2236@TK2MSFTNGP09.phx.gbl...
> Subject should actually read
> Modifying Xslt Nodes priot to Transformation
>
>
>
> <johndoe@driver.net> wrote in message
> news:uSKlXKaSEHA.1048@tk2msftngp13.phx.gbl...
>> In ASP 3.0 and MSXMLHTTP2 we would load Our Xslt file as an XmlDocument.
>> We then merely had to set the language and we could then execute Expath
>> queries against the document. This is especially useful for performing
>> actions upon Xslt Nodes that cannot be done through variables. After
>> modifying the Document via DOM one could then Transform it agianst the
>> Xml and get the expected results.
>>
>> I am looking for a way to have this same functionality in C#/ASP.NET. I
>> know how to use the XsltTransform Below is sample asp 3.0 code - the
>> functionality that i am attempting to duplicate in C# is the
>> set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
>> Where i grab all the sort nodes as XmlNodes that are modifyable
>>
>>
>>
>> Below is the ASP 3.0 code
>> I am having difficulty seeing exactly how this can be achieved with
>> ' Create XML and XSLT Document
>> Set xmlDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
>> Set xslDoc = Server.Createobject("MSXML2.DOMDocument.4.0")
>> ' Load up XML Data
>> xmlFile = Server.MapPath("TheData.xml")
>> xmlDoc.async = false
>> xmlDoc.load(xmlFile)
>> ' Load up XSLT Value
>> xslFile = Server.MapPath("OurXsltFile.xsl")
>> xslDoc.async = false
>> xslDoc.load(xslFile)
>> ' xslDoc.setProperty
>> "SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform&...
>> ' force it to use hack
>> xslDoc.setProperty "SelectionLanguage","XPath"
>>
>> set firstNameNode = xslDoc.selectNodes("//*[name()='xsl:sort']")
>> ' Code to modify the nodeList setting attributes we need
>>
>>
>
>


(Ying-Shen Yu[MSFT])

6/4/2004 3:18:00 AM

0

Hi,
This KB Article might be helpful to you:
<HOW TO: Implement Common MSXML Tasks in System.xml By Using Visual C# .NET>
http://support.microsoft.com/...
If you still have problem on this issue please feel free to reply this
thread.
Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.

johndoe@driver.net

6/4/2004 3:21:00 AM

0

I solved it by using Loading the Xslt Document, Modifying the Xslt nodes i
needed and then creating a node reader from the document and then Loading
the NodeReader with Transform. I just needed to read a tinytidbit on
somebodys blogs that the XmlNodeReader could be used in replace of (2 other
things)


s
""Ying-Shen Yu[MSFT]"" <v-yiy@online.microsoft.com> wrote in message
news:F9kl7HdSEHA.3960@cpmsftngxa10.phx.gbl...
> Hi,
> This KB Article might be helpful to you:
> <HOW TO: Implement Common MSXML Tasks in System.xml By Using Visual C#
> .NET>
> http://support.microsoft.com/...
> If you still have problem on this issue please feel free to reply this
> thread.
> Thanks!
>
>
> Best regards,
>
> Ying-Shen Yu [MSFT]
> Microsoft Community Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> This mail should not be replied directly, please remove the word "online"
> before sending mail.
>