Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Question: Functions; I have input, but no output. What's wrong with my XSLT?

$
0
0

I have been following the guide at http://docs.composite.net/XSLT/SQLFunctions to output some information from a SQL database on to a C1 page.

My connection string works fine. The SQL statement:

SELECT TOP 1 tblSubjectMatrix.*
FROM [marketing].[dbo].[tblSubjectMatrix]
WHERE URL = @URL

... takes an input parameter 'URL' and returns one record.

I've linked the results with an XSLT:

<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:in="http://www.composite.net/ns/transformation/input/1.0"
xmlns:lang="http://www.composite.net/ns/localization/1.0"
xmlns:f="http://www.composite.net/ns/function/1.0"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xsl in lang f"><xsl:templatematch="/"><html><head></head><body><xsl:apply-templatesselect="/in:inputs/in:result[@name='URL']/root/NewDataSet/Table"/></body></html></xsl:template><xsl:templatematch="/in:inputs/in:result[@name='URL']/root/NewDataSet/Table"><h1>test</h1><p>ID: <xsl:value-ofselect="ID"/></p><p>GradLevel: <xsl:value-ofselect="GradLevel"/></p><p>Subject: <xsl:value-ofselect="Subject"/></p></xsl:template></xsl:stylesheet>

My functions calls are:

<f:functionsxmlns:f="http://www.composite.net/ns/function/1.0"><f:functionname="Courses.AllSubjects"localname="AllSubjects"><f:paramname="URL"><f:functionname="Composite.Constant.String"><f:paramname="Constant"value="/sql-demo"/></f:function></f:param></f:function></f:functions>

On the preview tab, my input is:

<in:inputsxmlns:in="http://www.composite.net/ns/transformation/input/1.0"><!-- Function Call Result (4 ms), XPath /in:inputs/in:result[@name='AllSubjects']/root --><in:resultname="AllSubjects"><root xmlns="">
            <NewDataSet><Table><ID>132</ID><GradLevel>Special</GradLevel><Subject>TEST Subject</Subject><Type>Special</Type><SubType/><School>TEST School</School><Sites>Newton Park</Sites><URL>/sql-demo</URL><URLwww2>/sql-demo</URLwww2></Table></NewDataSet></root></in:result></in:inputs>

... but on the output tab, I get:

<htmlxmlns="http://www.w3.org/1999/xhtml"><head/><body/></html>

Why is this? I should get at least one HTML formatted result.

On a related issue, how do I capture the URL of the displaying C1 page to use in the function?

As always, any help given will be gratefully received.


Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>