如何将多个文件内容插入xml?

如何将多个文件内容插入xml?,xml,powershell,xslt,oxygenxml,Xml,Powershell,Xslt,Oxygenxml,我有一个xml文件,为Workday集成提供输入。输入是一个xml文件,通常在Excel中打开,并通过粘贴SQL查询的输出来填充。但是,这个特定的xml需要填充超过Excel单元格大小限制的数据。单元格数据是base64编码的.pdf文件。一列中的每个单元格将包含一个.pdf文件的内容。 我能够创建xml,其中文件内容单元格用短文本字符串(“文件内容”)标记,但我需要某种方法用编码的文件内容替换这些标记。 我确信一定有工具可以实现这一点,但我对xml操作相对较新。我想到的可能是Powershel

我有一个xml文件,为Workday集成提供输入。输入是一个xml文件,通常在Excel中打开,并通过粘贴SQL查询的输出来填充。但是,这个特定的xml需要填充超过Excel单元格大小限制的数据。单元格数据是base64编码的.pdf文件。一列中的每个单元格将包含一个.pdf文件的内容。 我能够创建xml,其中文件内容单元格用短文本字符串(“文件内容”)标记,但我需要某种方法用编码的文件内容替换这些标记。 我确信一定有工具可以实现这一点,但我对xml操作相对较新。我想到的可能是Powershell、xslt或某个氧气应用程序,但我不知道哪一个最好(XML编辑器?作者?)。附件是在Excel和Oxygen中打开的xml的图像。

XSLT3与EXPath文件模块、Saxon EE和流媒体技术在某种程度上符合

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:file="http://expath.org/ns/file"
    xpath-default-namespace="put excel namespace here"
    exclude-result-prefixes="#all"
    version="3.0">

    <!-- adjust these integers to match the cell index of the real input -->
    <xsl:param name="cell-index-file-name" as="xs:integer" select="3"/>
    <xsl:param name="cell-index-file-contents" as="xs:integer" select="6"/>
    
    <xsl:mode streamable="yes" on-no-match="shallow-copy" use-accumulators="#all"/>
    
    <xsl:accumulator name="pos" as="xs:integer?" initial-value="()" streamable="yes">
        <xsl:accumulator-rule match="Table" select="()"/>
        <xsl:accumulator-rule match="Table/Row" select="0"/>
        <xsl:accumulator-rule match="Table/Row/Cell" select="$value + 1"/>
    </xsl:accumulator>
    
    <xsl:accumulator name="file-name" as="xs:string?" initial-value="()" streamable="yes">
        <xsl:accumulator-rule match="Row/Cell[accumulator-before('pos') eq $cell-index-file-name]/text()" select="data()"/>
    </xsl:accumulator>
    
    <xsl:template match="Row/Cell[accumulator-before('pos') eq $cell-index-file-contents]">
        <xsl:copy>
            <xsl:value-of select="file:read-binary(resolve-uri(accumulator-before('file-name')))"/>
        </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>


XSLT 2或3,您可以使用Saxon 9或10的商业版以及EXPath模块(例如)在oXygen内部执行,它应该能够将包含对PDF的引用的文档转换为包含base64编码文件内容的文档。感谢Martin的推荐。我确实安装了Java并下载了Saxon Enterprise Edition,并进行了一些试验。这对我来说很有教育意义,但出于各种原因,包括我本该有的学习曲线,我使用了更熟悉的工具来克服这个问题。我在App.Engine中使用PeopleCode生成xml的Excel“行”块。我使用PeopleSoft提供的函数GetBase64StringFromBinary()对文件内容进行编码。