XRL issue

Poster Content
nk4um User
Posts: 9
September 15, 2011 16:44

Gary,

You might also want to look at this discussion on the netkernelroc.org forum:

http://www.netkernelroc.org/nk4um/topic/5/

cheers,

   -tom
Like · Post Reply
nk4um Administrator
Posts: 607
September 15, 2011 13:59

Hi Gary,

this is an unfortunate limitation of XML - all documents must have a single root. So the template must specify one, as in your example and the response from mergePhones.gy must have a single root too. Therefore you will always end up with the two levels. Three possible solutions I can suggest are: 1) can you live with the schema of this document having the two levels? 2) a post processing step using xslt to remove the double level 3) rather than using xslt and xrl using a groovy script to iterate over the resultset

Cheers, Tony

Like · Post Reply
nk4um User
Posts: 92
September 14, 2011 21:06XRL issue

Another issue I am having with xrl:include. I have a xslt.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:nk="http://netkernel.org" version="1.0" xmlns:xrl="http://netkernel.org/xrl">

   <xsl:output method="xml"/>
   <xsl:template match="/">
        <phones>
           <xsl:apply-templates/>
            </phones>
   </xsl:template>
   <xsl:template match="/resultset/row">
       <xrl:include>
           <xrl:identifier>active:groovy</xrl:identifier>
           <xrl:argument name="operator">res:/resources/findlawcustomer/profile/phone/mergePhones.gy</xrl:argument>
           <xrl:argument name="wld">res:/findlawcustomer/<xsl:value-of select="WLD_ID"/>/profile/phone/wld</xrl:argument>
           <xrl:argument name="calltracking">res:/findlawcustomer/<xsl:value-of select="WLD_ID"/>/profile/phone/calltracking</xrl:argument>
       </xrl:include>
   </xsl:template>

</xsl:stylesheet>

If I use this, I get the expected result - the xrl:include fires. This is because I have the <phones> element surrounding apply-templates. However, the groovy script comes back with a <phones> root and this means I have 2 levels of <phones>. If I remove the <phones> from the stylesheet, then the result I get in my request is the <xrl:include> code. How do I get the xrl:include to fire when there is no <root> node specified in stylesheet. If I remove the <phones> from the groovy root, I get an <hds> root.

This stylesheet pattern is part of the framework I have been putting together and I made the possibly incorrect assumption that from calling to the stylesheet, if the regular pattern was not matched, the developer could create their own separate resource and make a request to it. However, this double layer is something I am having troubles coming up with a work around. Any ideas?

Like · Post Reply