AnsweredAssumed Answered

parseXMLDocument and Rendering Engine Template Woes

Question asked by kooktroop on Apr 4, 2007
Latest reply on Apr 5, 2007 by kooktroop
What I am trying to do is read an element (pm:deliverable/pm:name) from another XML file in Alfresco. The other file is specified by a ref element of type xs:anyURI.

I'm having problems with parseXMLDocument and the rendering engine templates.

When I comment out the parseXMLDocument function/section the following stylesheet renders the html just fine. When I include parseXMLDocument the resulting html is just blank.

<?xml version="1.0" encoding="UTF-8" ?>
    Document   : description.xsl
    Created on : 28 March 2007
    Author     : Scott Middleton
    This stylesheet transforms the description section of a Process Unit.
<xsl:stylesheet version="2.0"

  <xsl:output method="html"></xsl:output>

  <xsl:template match="/">
    <xsl:apply-templates select="pm:processunit"/>

  <xsl:template match="pm:processunit">
        <xsl:when test="pm:deliverables/pm:overview">
            <xsl:value-of select="pm:deliverables/pm:overview" disable-output-escaping="yes" />
          The following are deliverables for the <xsl:value-of select="pm:name" /> Process Unit:
    <xsl:apply-templates select="pm:deliverables/pm:deliverablereference" />

  <xsl:template match="pm:deliverablereference">
    <p>Ref: <xsl:value-of select="pm:ref" /></p>
           pm:ref is something like "/content/xml/Somefile.xml"
           Note: this file does exist!

    <!– if i comment this 'if' and its contents out then there is output –>
    <xsl:if test="pm:ref">
        <xsl:variable name="deliverableRef" select="pm:ref" />
        <xsl:variable name="deliverable" select="alf:parseXMLDocument( $deliverableRef )" />

            <xsl:if test="$deliverable">
<xsl:value-of select="$deliverable/pm:name" />

I've tried replacing parseXMLDocument with document(), I've tried matching as much as possible to the sample. The sample works just fine. I know that the uri for the file I am trying to access is valid because when I comment out parseXMLDocument and just do <xsl:value-of select="pm:ref" /> the value looks fine. I've just run out of things to try.

Any help would be much appreciated!