WORKING WITH MEDIA
Working with media and XSLT is a bit specialized. It relies heavily on the use of XSLT extensions because media is not cached or treated the same as standard content nodes are in Umbraco. A media item has several properties, as discussed in Chapter 2. Most commonly, you want to use XSLT to output a media item that someone selected as part of the content entry using the Media Picker data type, as shown in Figure 11-3.
If you queried the FAQ node in this case to get the selected media item, all you would get back is the media node Id. Listing 11-2 shows an extract of the FAQ node as it would come back to you when you query for it in Listing 11-3.
LISTING 11-2: FAQ Node from Cache
<FAQ id=“1057” parentID=“1055” level=“3” writerID=“0” creatorID=“0” nodeType=“1053” template=“0” sortOrder=“2” createDate=“2010-11-18T07:08:03” updateDate=“2011-01-21T17:03:17” nodeName=“How do I add a page?” urlName=“how- do-i-add-a-page” writerName=“Administrator” creatorName=“Administrator” path=“-1,1048,1055,1057” isDoc=“”> <author>Nik</author> <category><![CDATA[2]]></category> <screenshot>1091</screenshot> <question><![CDATA[ <p>I was just wondering how I might add a page to the backend?</p> ]]></question> <answer><![CDATA[ <p>d</p> ]]></answer> </FAQ>
LISTING 11-3: ...
Get Umbraco User's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.