Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Dynamic xslt and transform with-out System.IO
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
schneider  
View profile  
 More options Dec 15 2004, 5:57 am
Newsgroups: microsoft.public.dotnet.xml
From: "schneider" <0...@0000.SPAM>
Date: Wed, 15 Dec 2004 04:57:26 -0600
Local: Wed, Dec 15 2004 5:57 am
Subject: Dynamic xslt and transform with-out System.IO
Anyone know if there is a way to dynamicly create a Xslt template/s and use
them as an
xml transform with-out use files for the Xslt?

All the methods I see use files.

I want to create a Xslt transform via code?

Any examples would be great.

Thanks,

Schneider


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleg Tkachenko [MVP]  
View profile  
 More options Dec 15 2004, 6:08 am
Newsgroups: microsoft.public.dotnet.xml
From: "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com>
Date: Wed, 15 Dec 2004 13:08:27 +0200
Local: Wed, Dec 15 2004 6:08 am
Subject: Re: Dynamic xslt and transform with-out System.IO

schneider wrote:
> Anyone know if there is a way to dynamicly create a Xslt template/s and use
> them as an
> xml transform with-out use files for the Xslt?

> All the methods I see use files.

> I want to create a Xslt transform via code?

Basically any XSLT stylesheet is just XML document, so of course you can
build it in-memory using XmlDocument. Another common approach is to
generate XSLT stylesheets on the fly using XSLT (again - as XSLT is XML,
the best way to generate/transform it is XSLT itself).

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
schneider  
View profile  
 More options Dec 15 2004, 4:15 pm
Newsgroups: microsoft.public.dotnet.xml
From: "schneider" <0...@0000.SPAM>
Date: Wed, 15 Dec 2004 15:15:21 -0600
Local: Wed, Dec 15 2004 4:15 pm
Subject: Re: Dynamic xslt and transform with-out System.IO
So you are saying to create a xslt with a XmlDocument object?

I still don't see any way to create a XslTransform from a XmlDocument?

Have any sample code?

Thanks,

Schneider

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:OfrMnap4EHA.1564@TK2MSFTNGP09.phx.gbl...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dennis Myrén  
View profile  
 More options Dec 16 2004, 4:17 am
Newsgroups: microsoft.public.dotnet.xml
From: "Dennis Myrén" <den...@oslokb.no>
Date: Thu, 16 Dec 2004 10:17:44 +0100
Local: Thurs, Dec 16 2004 4:17 am
Subject: Re: Dynamic xslt and transform with-out System.IO
You would have to first load the XSLT document into an XmlDocument object.
XmlDocument xsltDoc = new XmlDocument();
xsltDoc.LoadXml(xsltString);
Then, create an XslTransform and, now, load the XSLT document into the
transform by creating an XPathNavigator from the document:
XslTransform transform = new XslTransform();
transform.Load(xsltDoc.CreateNavigator(), null, null);
Assuming you have the XML document loaded into a XmlDocument as well,
you are now ready to perform the transformation.
Let's use a System.IO.MemoryStream as the output channel.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
XsltArgumentList args = new XsltArgumentList();
MemoryStream output = new MemoryStream(100000);
// Put any XSLT transform parameters into 'args' here.
transform.Transform
  (xmlDoc.CreateNavigator(), args, output, null);

All this can be done in RAM without a single read/write to the hard drive.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau

"schneider" <0...@0000.SPAM> wrote in message

news:eFYDvpu4EHA.3236@TK2MSFTNGP15.phx.gbl...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleg Tkachenko [MVP]  
View profile  
 More options Dec 16 2004, 7:56 am
Newsgroups: microsoft.public.dotnet.xml
From: "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com>
Date: Thu, 16 Dec 2004 14:56:57 +0200
Local: Thurs, Dec 16 2004 7:56 am
Subject: Re: Dynamic xslt and transform with-out System.IO

schneider wrote:
> So you are saying to create a xslt with a XmlDocument object?

> I still don't see any way to create a XslTransform from a XmlDocument?

Hmmm, I really wonder why... Have you looked at XslTransform.Load() methods?
There is probably something wrong with the API as you (and you arent'
the first one) can't see that XmlDocument implements IXPathNavigable and
you can just pass XmlDocument instance into the XslTransform.Load() method.

It's as as simple as:

XslTransform xslt = new XslTransform();
xslt.Load(doc);

In .NET 1.1 you'll get compiler warning that you have to pass an
evidence, so use
xslt.Load(doc, null, null);

or

xslt.Load(doc, new XmlUrlResolver(),
Assembly.GetExecutingAssembly().Evidence);

if you need a URI resolving during stylesheet's load (e.g. you are using
xsl:include/xsl:import).

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google