Umbraco is turning 5!
There's already 324 people signed up for the February 16th celebrations, what about you? join now

is there umbraco api to handle xsl transformation from code behind

Go directly to solutionA reply has been marked as a solution
7/3/2009 5:58:23 PMAvatarNikola PetkovicLocation: Serbiaposts: 52Karma: 51

Hi folks,

what I actually want to do is to use one of the XSLT files (i regularly use in macros) to apply on umbraco content xml tree, but from codebehind.

Anyone tried this before?

 

7/3/2009 10:31:22 PMAvatarDirk De GraveLocation: LotenhulleMVP.admin.posts: 2825Karma: 2636
Comment with ID: 8546

Nikola,

.net has pleny to api to handle xslt transformations. I suggest to perform a search on msdn on how to apply a transformation on an xml.

Here's a first reference on xslt transformation that should het you started: msdn.microsoft.com/.../...slcompiledtransform.aspx

 

Cheers,

/Dirk

 

 

7/4/2009 12:29:28 PMAvatarTim GeyssensLocation: Zottegem, BelgiumMVP.Core.admin.posts: 1253Karma: 1060
Comment with ID: 8558

Sure, that pretty easy, check out the sourcecode for the locator package on codeplex

http://locator4umbraco.codeplex.com/

7/4/2009 12:34:33 PMAvatarTim GeyssensLocation: Zottegem, BelgiumMVP.Core.admin.posts: 1253Karma: 1060
Comment with ID: 8561

Should be something like:

umbraco.macro.GetXsltTransformResult(content, umbraco.macro.getXslt(ResultsXslt)); 

7/4/2009 12:36:16 PMAvatarTim GeyssensLocation: Zottegem, BelgiumMVP.Core.admin.posts: 1253Karma: 1060
Solution Comment with ID: 8562
100

Where content is umbraco.content.Instance.XmlContent</span>

And ResultsXslt is just the name of the xslt file in your /xslt folder 

7/6/2009 2:55:26 PMAvatarNikola PetkovicLocation: Serbiaposts: 52Karma: 51
Comment with ID: 8710

@Dirk: Great Dirk, thanks for the reference. Unfortinatelly, I tried this at first, but those methods cannot recognize "the references" to umbraco library methods used in my XSLT. Thats why I was sure that umbraco core took care of properly running xslt by their apis ;)

@Tim: You rock... works like a charm. Thanks a billion.

Please login or Sign up To post replies