XSLT 2.0 Options
dcrug
Posted: Thursday, May 08, 2008 5:44:53 PM
Rank: Newbie

Joined: 5/2/2008
Posts: 13
Location: NYC
Does anyone know if umbraco supports XSLT 2.0, or has a substring function I can use to grab a piece of a string from a alias.
drobar
Posted: Thursday, May 08, 2008 6:12:16 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,083
Location: KY, USA
Umbraco uses the MSXML 6.0 parser. Microsoft specifies the following:

The Microsoft Core XML Services (MSXML) 6.0 release provides standards-conformant implementations of:
* XML 1.0 (DOM & SAX2 APIs)
* XML Schema (XSD) 1.0
* XPath 1.0
* XSLT 1.0

Now... in your example of substring()... that's actually an XSLT 1.0 feature so you don't need to do anything special at all.

But... if you did need to do something not provided by the MSXML parser, there are four ways to get functionality beyond that of XSLT 1.0:
1. Look in the umbraco.library extension included with umbraco. There are a lot of extremely useful functions in there!

2. Look in the EXSLT extensions included with umbraco. You will need to add these to the header block of your xslt.

3. Write your own in-line functions in javascript or c# (or any .net language)

4. Create your own xslt extension library

The first two are easiest. When you're in the xslt editor of umbraco, click the Insert Value-of icon on the toolbar. Then click the "Get Extension" button. You'll find all sorts of goodies in there.

There are various books and blogs and wiki articles on in-line functions and making your own xslt extensions.

cheers,
doug.

MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
dcrug
Posted: Thursday, May 08, 2008 6:37:53 PM
Rank: Newbie

Joined: 5/2/2008
Posts: 13
Location: NYC
Do you happen to know if there is a way to store an @alias into a variable.
drobar
Posted: Thursday, May 08, 2008 6:43:40 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,083
Location: KY, USA
Try this...

<xsl:variable name="myVar" select="$currentPage/node/data [@alias='myAlias']" />

If you're in a for-each loop, it would be more like...

<xsl:variable name="myVar" select="data [@alias='myAlias']" />

cheers,
doug.

[EDIT: note to self... always try the code rather than typing directly in the forum! I've fixed the xslt shown above to work now d'oh! ]

MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.