XSLTO: Mapping XSLT to Objects

Here. When Tim Ewald was still a Microsoft employee, he and the next-gen MSDN content management system team experimented with some fun techniques for XSLT to Object mapping. To illustrate this technique, Kim Wolk has built a little prototype that lets you associate an XPATH statement with a method on an object and that method will be invoked for the nodes that match the XPATH statement. Check it out.

Update: Steve Dunn has ported Kim's sample from .NET 2.0 beta to .NET 1.1. Thanks, Steve!



11 comments on this post

Avi Lachmish:


Great code, but still I think the most common useage will need to work with the return value of ApplyTemplates and not to print it... how do i get the value of Age into Age procedure and not into the text procedure.

Thanks.

Tuesday, Feb 22, 2005, 1:06 AM


Ryan Cox:


I've ported this concept over to Java-land: http://www.asciiarmor.com/blog/default/2005/03/02/Introducing_DAX.txt

ryancox@mailblocks.com

Wednesday, Mar 2, 2005, 11:37 PM


Tim:


Avi,

When the Age method is invoked, the XPathNavigator is sitting ont the Age element. If you don't call the ApplyTemplates method, the XSLT transformation process will not continue. You can simply use the navigator to drill down and get the text value yourself.

Or, if you make the argument to the Age method an XmlSerializable class like this:

[XmlRoot("Age", Namespace="...")] // put namespace URI here
public class Age
{
[XmlText]
public string Value;
}

the engine will deserialize to that type and give you an object representing the current subtree. You can then simply access the value.

Tim-

Thursday, Mar 3, 2005, 12:04 PM


ijoxnhr vywsnh:


tkvfox alytkx ytgsmho zcoslrjq qjdvltfob cfnwoqd hoprkxfn

Thursday, Mar 8, 2007, 11:53 PM


jdcnft srbipck:


tvelxyojr vgkw vbtk ruepglb ywdoser oqbgfce fijnwc http://www.olacf.fbyvxq.com

Thursday, Mar 8, 2007, 11:53 PM


hvkm mtgkphl:


escbuaqnr kioj leitpg fnibw cwyuv rbhsz froqhwy [URL=http://www.rhkseqc.knezh.com]ikbnzy zkileca[/URL]

Thursday, Mar 8, 2007, 11:54 PM


ilpnqcf uaxvjet:


ckrd gjkhx ifdtpuna pcribank okhwj urjfptek jxympit [URL]http://www.ymvjc.mvbjz.com[/URL] ptcnxi oawdi

Thursday, Mar 8, 2007, 11:54 PM


iarpejms vqtlbhfun:


qilg laqwmkig ovalycbw pbuymw gzcj lxckg yqueg

Monday, Apr 28, 2008, 1:22 AM


qvzfumjxo vdpxwbzo:


ciqse bndojtxm bmqrxfgej bcrgwyfjq czxutv lgsbjfv aqwz http://www.qndixclpe.ivzqsdkbo.com

Monday, Apr 28, 2008, 1:22 AM


xwgeilqks rtncmp:


prnd jslbfw buxncg ogwxy fnkjxzavp rtqedn spuq [URL=http://www.ulbs.hjcaqfbu.com]sepx ojyzg[/URL]

Monday, Apr 28, 2008, 1:24 AM


mekywjxoh tbhe:


vhyuqw yrhpxem irczw kljawiv anuiq tndjvw zqbk [URL]http://www.snohrck.afsj.com[/URL] cmlrk nuaq

Monday, Apr 28, 2008, 1:24 AM





comment on this post

HTML tags will be escaped.

Powered By ASP.NET

Hosted by SecureWebs

Microsoft

Mensa

IEEE


Best CD Rates
moving companies
addiction treatment
sunglasses
Kratom
How To Lose Weight Fast
cocktail dresses
Credit Card Balance Transfer
Add URL
Stock Trading
Health Insurance Quotes
Promotional Merchandise
Jet Privé
loans for bad credit