Wednesday, 20 January 2016

XML : I'm trying to generate an xml output from several xml files

I have a toplevel "index" file that may or may not have an element listing a series of additional files. All of the files are in xml format, but have an extension like ".exlog". First question, can the xsl function document() handle a uri for a file that is xml, but does not have the xml extension? I can't find documentation online for this.

I've gone ahead and resaved the files to have a .xml extension just in case, and I've saved the files to the same directory. My XSL file has the section below, and everything works EXCEPT for all of the calls to the document function - those always return nothing:

     <xsl:template match="tasktype">     <xsl:if test="looptask">      <Row>          <Cell><Data ss:Type="String">              <xsl:value-of select="looptask/@label"/>          </Data></Cell>            <Cell><Data ss:Type="String">              <xsl:value-of select="looptask/taskinfo/definition"/>          </Data></Cell>        </Row>      <xsl:for-each select="looptask/looplogs/looplog">      <xsl:variable name="loopFile" select="document('fault_4_F19.xml')/results/iteration"/>      <Row>          <Cell><Data ss:Type="String">          <xsl:value-of select="@path"/>          </Data></Cell>          <Cell><Data ss:Type="String">          <xsl:value-of select="$loopFile"/>          <xsl:value-of select="document('source.xml')/results/iteration"/>          </Data></Cell>      </Row>      </xsl:for-each>  </xsl:if>  </xsl:template>    

The source.xml file looks like the code below, and I'm running the rest of the xsl on a parent xml file.

      <?xml version="1.0" encoding="utf-8"?>  <results>  <iteration value="F19">help!</iteration>  <tasktype>      <task label="task1">          <taskinfo>              <definition>text</definition>          </taskinfo>      </task>  </tasktype>  <iteration_results status="Fail"/>    

It doesn't matter what I do, I cannot get the document function to return any information. I feel like I must be missing something obvious.

FWIW, I'm using notepad++ to run the transform file on the master xml document.

No comments:

Post a Comment