1

Please note that I have a working version, it's just that Eclipse doesn't like it so I'm trying to make sure I've done it properly. I don't have much XSLT experience.

I have a top-level file (main.xsl ) that acts as a wrapper/root element for a whole bunch of sub-elements, mostly independent of each other. I needed some string-substitution in many of these sub-files, to convert between valid XML and a legacy format (doesn't like CRLF).

So I've got the substitution templates in a utils.xsl file, inluded in main.xsl, and I'm using to invoke them on whatever elements need it. Samples below, this runs and the substitution is done correctly.

But Eclipse is unhappy with the call-template, because RecordOneData.xsl doesn't know about the utils.xsl include in main.xsl. Is there a more elegant solution, or is this just a limitation in Eclipse validation I'll have to live with?

Edited to add - note folder structure of xsl files - I've tried moving the include to each calling xsl file, but as the imports are resolved based on the location of the main.xsl file being loaded, Eclipse doesn't like the path. An absolute path might solve that, but, ugh...

 Root Folder
  L main.xsl
  L RecordGroupOneFolder
       LRecordOneData.xsl
       L RecordTwoData.xsl
  L RecordGroupTwoFolder
       L ...
  L CommonFolder
       L utils.xsl

RecordOneData.xsl:

<xsl:template match="item[itemMapCode='141']" mode="RecordOneDetail">
    <CommentArray>
        <xsl:call-template name="string-decode-crlf">       
                                   ^^^-- Eclipse:"Named template not available"
         <xsl:with-param name="text" select="./itemValue" />
        </xsl:call-template>
    </CommentArray>
</xsl:template>  

utils.xsl based on XSLT string replace

Many thanks.

<<< Edited to add - I'm stuck with XSLT 1.0 :( >>> <<< 2nd edit - fleshing out file-structure for clarity >>>

Community
  • 1
  • 1
NielsR
  • 91
  • 1
  • 8

0 Answers0