Guide

Previewing Functions

The Preview tab consists of two panes: Input and Output.

Figure 11: Function preview

Input Preview

In the Input pane, you can see all the inputs used in your functions, which include input parameters with values if any and function call results if any.

<in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
<!-- Input Parameter, XPath /in:inputs/in:param[@name='DisplayMode'] -->
<in:param name="DisplayMode">true</in:param>
</in:inputs>

Listing 11: Input parameter

<in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
<!-- Function Call Result (65 ms), XPath /in:inputs/in:result[@name='GetUsersXml']/Users -->
<in:result name="GetUsersXml"><Users Id="1e4b9093-9047-4e88-8496-e46bcb48d3c1" Name="John Doe" Email="john.doe@omnicorp.org" PublicationStatus="published" xmlns=""/><Users Id="b8d9208a-3050-4991-b595-c86ebcd35119" Name="Jane Doe" Email=" jane.doe@omnicorp.org" PublicationStatus="published" xmlns=""/></in:result>
</in:inputs>

Listing 12: Function call results

When you add an input parameter or a function call to your function and switch to the Preview tab, a comment is generated for the input parameter and the function call, showing how to refer them in your XSLT.

The function call’s comment also features the function call execution time.

<!-- Function Call Result (65 ms), XPath /in:inputs/in:result[@name='GetUsersXml']/Users -->

Listing 13: Function call result with execution time

The comment to extension functions such as Composite.Xslt.Extensions also includes a list of the functions you can use in your XSLT.

    <!-- Function call result 'DateFormatting' has been registered as an Xslt Entension Object. -->
    <!-- Extension methods can be called using the namespace '#dateExtensions'. -->
    <!-- The following methods exist: -->
    <!-- String ns:Now() -->
    <!-- String ns:LongDateFormat(String xmlFormattedDate) -->
    <!-- String ns:LongTimeFormat(String xmlFormattedDate) -->
    <!-- String ns:ShortDateFormat(String xmlFormattedDate) -->
    <!-- String ns:ShortTimeFormat(String xmlFormattedDate) -->
    <!-- Int32 ns:Day(String xmlFormattedDate) -->
    <!-- Int32 ns:Month(String xmlFormattedDate) -->
    <!-- Int32 ns:Year(String xmlFormattedDate) -->
    <!-- String ns:LongMonthName(Int32 monthNumber) -->
    <!-- String ns:ShortMonthName(Int32 monthNumber) -->
    <!-- String ns:Format(String xmlFormattedDate, String DateFormat) -->

Listing 14: List of extension functions

If the input parameter has a value, it will be presented within the <in:param> element. If the input function contains data, it will be presented within the <in:result> element.

Output Preview

In the Output pane, you can see the markup that your XSLT function will emit when used.

The actual output depends on the Debug settings. For example, if your XSLT requires a specific page to work properly, you should choose a page in the Debug settings.

Wrong debug settings might sometimes account for empty output.

If an error is displayed instead of markup in the output, there might be an error in your XSLT and you need to validate it before previewing the function.

The lower part of the output pane shows the execution time for the entire XSLT function as well as for its constituent parts: functions and XSLT itself.

Figure 12: Execution time