Media File ID not available in XSLT function

Topics: Troubleshooting, XSLT
Apr 19, 2011 at 1:51 AM
Edited Apr 19, 2011 at 1:52 AM


I installed the Community package and added a new field name AudioFile to the Composite.Community.Blog.Entries data type. The field is a data reference.

So that users could specify a media file, I added support for the field via the form markup. To test it, I uploaded an MP3 file and created a blog entry that references the MP3 file via the AudioFile field.

I verified that the *_Published.xml file under App_Data contains a value for the new field. Finally, I modified the BlogRenderer XSLT function so that it would test for existence of an audio file, just like the test for {@Image.Id} in the same function:

      <xsl:if test="@AudioFile.Id != ''">
        <a href="#">Test</a>

However, the test does not evaluate to true, even if I specify "@AudioFile.Id = ''".

How do I figure out why it does not work as expected?


Apr 19, 2011 at 8:55 AM

Make sure you edited function call named "GetEntriesXml" and selected your field.  
I.e. Functions tab => XSLT functions => edit Composite.Community.Blog.BlogRenderer => Function Calls => GetEntriesXml => Selected fields => Edit selections => select your field. Save.

Apr 19, 2011 at 1:54 PM

If I understood your question correctly, you need something like

<xsl:if test="count(@AudioFile.Id) > 0">

Apr 22, 2011 at 4:31 AM

Thank you! Adding the AudioFile.Id property as a selected field solved the problem.