Мне нужно разобрать xsl вместе с его параметрами с помощью кода VBA. Я могу использовать код VBA из приведенной ниже ссылки (для вашей справки), но только мне нужно передать параметры XSLT через код VBA.Excel VBA Кодирование для преобразования xls вместе с Parameters
My (ds_test.xsl) файл
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:param name="job" />
<xsl:param name="src" />
<xsl:param name="spath" />
<xsl:template match="/">
<DSExport>
<Job>
<xsl:attribute name="Identifier">
<xsl:value-of select="$job" />
</xsl:attribute>
<Record Identifier="V25S0P1" Type="CustomOutput" Readonly="0">
<Collection Name="Columns" Type="OutputColumn">
<xsl:copy-of select="document($src)//Record[@Identifier=$spath]//SubRecord" />
</Collection>
</Record>
</Job>
</DSExport>
</xsl:template>
</xsl:stylesheet>
Мой вход (Metadata.xml файл)
<?xml version="1.0" encoding="UTF-8"?>
<DSExport>
<Header CharacterSet="CP1252" ExportingTool="IBM InfoSphere DataStage Export" ToolVersion="8" ServerName="HCL-BOEING-DS" ToolInstanceID="EFBI_BAL_OPT" Date="2014-01-21" Time="19.09.04" ServerVersion="9.1" />
<TableDefinitions>
<Record Identifier="TEST1" DateModified="2013-12-23" TimeModified="11.01.03" Type="MetaTable" Readonly="0">
<Collection Name="Columns" Type="MetaColumn">
<SubRecord>
<Property Name="Name">BEMSID</Property>
<Property Name="Description">BEMSID: string[max=10]</Property>
<Property Name="SqlType">12</Property>
<Property Name="Precision">10</Property>
</SubRecord>
<SubRecord>
<Property Name="Name">EMPL_NM</Property>
<Property Name="Description">EMPL_NM: string[max=18]</Property>
<Property Name="SqlType">12</Property>
<Property Name="Precision">18</Property>
</SubRecord>
</Collection>
</Record>
</TableDefinitions>
</DSExport>
Мой ожидаемый выход в формате XML (output.xml)
Примечание: Вот мой вопрос: во время выполнения я должен передать значение параметра XSL через Excel Код VBA, как я упоминал ранее. Будем считать, что я даю ниже значения параметра
- $ работа = "PXJ_TEST1"
- $ ЦСИ = "Metadata.xml"
- $ SPATH = "TEST1"
output.xml должен быть ниже формате
<?xml version="1.0" encoding="UTF-8"?>
<DSExport>
<Job Identifier="PXJ_TEST1">
<Record Identifier="V25S0P1" Type="CustomOutput" Readonly="0">
<Collection Name="Columns" Type="OutputColumn">
<SubRecord>
<Property Name="Name">BEMSID</Property>
<Property Name="Description">BEMSID: string[max=10]</Property>
<Property Name="SqlType">12</Property>
<Property Name="Precision">10</Property>
</SubRecord>
<SubRecord>
<Property Name="Name">EMPL_NM</Property>
<Property Name="Description">EMPL_NM: string[max=18]</Property>
<Property Name="SqlType">12</Property>
<Property Name="Precision">18</Property>
</SubRecord>
</Collection>
</Record>
</Job>
</DSExport>