Tag: xslt

使用XSLT从Excel中检索数据

我有一个excel如下,其中第5行的标题数据。 编辑: inputexcel也可能出现如下。 数据可能出现在任何列中。 数据必须使用行标题广告名称,UID和Status.It不会更改。 然后将其保存为工作簿xml,如下所示 <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Author>Jefferson D</Author> <LastAuthor>Jefferson D</LastAuthor> <Created>2015-10-29T17:10:31Z</Created> <LastSaved>2015-10-29T17:15:02Z</LastSaved> <Company>*CL</Company> <Version>12.0</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <AllowPNG/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>22060</WindowHeight> <WindowWidth>34400</WindowWidth> <WindowTopX>-20</WindowTopX> <WindowTopY>-20</WindowTopY> <Date1904/> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style ss:ID="Default" ss:Name="Normal"> <Alignment ss:Vertical="Bottom"/> <Borders/> <Font ss:FontName="Verdana"/> <Interior/> <NumberFormat/> <Protection/> </Style> <Style ss:ID="s16"> <Font […]

加载一个带有variables文件名的XML文件,用XSL进行转换

我正在寻找在Excel VBA中运行以下: Dim xmldoc As Object, xsldoc As Object, newdoc As Object Set xmldoc = CreateObject("MSXML2.DOMDocument") Set xsldoc = CreateObject("MSXML2.DOMDocument") Set newdoc = CreateObject("MSXML2.DOMDocument") ' LOAD XML xmldoc.async = False xmldoc.Load ActiveWorkbook.Path & "\Original.xml" ' LOAD XSL xsldoc.async = False xsldoc.Load ActiveWorkbook.Path & "\XSLT_File.xsl" ' TRANSFORM xmldoc.transformNodeToObject xsldoc, newdoc newdoc.Save ActiveWorkbook.Path & "\Output.xml" 我在相同的代码中运行这个,但之后,步骤,而原始的XML被导出 ActiveWorkbook.SaveAsXMLData […]

格式化和组织电子表格结果

我正在尝试使用以下代码创buildExcel文件 XML: <?xml version="1.0" encoding="utf-8"?> <Document> <Header> <NoInvoices>3</NoInvoices> <ExportDate>11-20-2015</ExportDate> </Header> <Invoices> <Type>CN</Type> <Customer>Juan</Customer> <CustAddress>New Bilibid</CustAddress> <InvNumber>01234</InvNumber> <Items> <Name>Sugar</Name> <Qty>2</Qty> <Price>5</Price> <Amount>10</Amount> <OrigInv>01235</OrigInv> </Items> </Invoices> <Invoices> <Type>SI</Type> <Customer>Juan</Customer> <CustAddress>New Bilibid</CustAddress> <InvNumber>01235</InvNumber> <Items> <Name>Coffee</Name> <Qty>5</Qty> <Price>25</Price> <Amount>125</Amount> </Items> <Items> <Name>Sugar</Name> <Qty>5</Qty> <Price>5</Price> <Amount>25</Amount> </Items> </Invoices> <Invoices> <Type>SI</Type> <Customer>Julianna</Customer> <CustAddress>New Wares</CustAddress> <InvNumber>01236</InvNumber> <Items> <Name>Margarine</Name> <Qty>1</Qty> <Price>50</Price> <Amount>50</Amount> </Items> […]

使用XSLT将XML循环到单个Excel单元格中

希望转换(XSL,XSLT到Excel): <NessusClientData_v2> <Report name="FAKEDB" xmlns:cm="http://www.nessus.org/cm"> <ReportHost name="192.168.1.1"> <HostProperties> <tag name="operating-system">Microsoft Windows Server 2008 R2 Enterprise Service Pack 1</tag> <tag name="host-fqdn">FAKEDB</tag> </HostProperties> <ReportItem port="0" svc_name="general" protocol="tcp" severity="0" pluginID="19506" pluginName="Nessus Scan Information" pluginFamily="Settings"> </ReportItem> <ReportItem port="1122" svc_name="availant-mgr?" protocol="tcp" severity="0" pluginID="11219" pluginName="Nessus SYN scanner" pluginFamily="Port scanners"> </ReportItem> <ReportItem port="1122" svc_name="ssh" protocol="tcp" severity="2" pluginID="10882" pluginName="SSH Protocol Version 1 Session […]

将XSLT转换为Excel

我必须将查询(xml格式)的结果转换为Excel文件。 查询结果示例: <?xml version="1.0" encoding="UTF-8"?> <dbqueries> <dbquery id="main"> <rows> <row user="Me" user-id="1"/> <row user="Myself" user-id="2"/> <row user="I" user-id="3"/> </rows> </dbquery> </dbqueries> 我使用以下XSLT: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:template match="/dbqueries"> <xsl:processing-instruction name="mso-application"> <xsl:text>progid="Excel.Sheet"</xsl:text> </xsl:processing-instruction> <Workbook> <Styles> <Style ss:ID="Default" ss:Name="Normal"> <Alignment ss:Vertical="Bottom" /> <Borders /> <Font /> <Interior /> […]

将XSLT v1.0变换与多个值分组,以将Filemaker Pro XML导出转换为Excel电子表格

我是新来的xslt转换,我有一些困难,得到我想要的结果。 我使用xslt转换将一组来自Filemaker Pro的logging导出为XML,以生成格式化的“.xls”文件。 这是我从Filemaker Pro使用的出口订单: 目标: 1.我希望每个不同的SupplierName都有自己的电子表格 通过InvoiceNo每个电子表格中的loggingInvoiceNo 编辑 :使用马丁的build议 <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" version="1.0" exclude-result-prefixes="fmp set" xmlns:set="http://exslt.org/sets" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="group" match="fmp:ROW" use="fmp:COL[4]/fmp:DATA"/> <xsl:key name="nested-group" match="fmp:ROW" use="concat(fmp:COL[4]/fmp:DATA,'+',fmp:COL[2]/fmp:DATA)"/> <xsl:template match="fmp:FMPXMLRESULT"> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <LastAuthor/> <Created/> <Version>11.9999</Version> </DocumentProperties> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> […]

如何使用XSLTdynamic创build工作表?

我想根据过程返回的数据集结果(所有数据集结果是相同的输出格式)dynamic创build工作表。 XML : <NewDataset> <Table> <record> <id>1</id> <name>sdf</name> <record> <record> <id>2</id> <name>sdfooop</name> </record> </Table> <Table1> <record> <id>1</id> <name>sdffff</name> <record> <record> <id>2</id> <name>sdfwerwerwe</name> </record> </Table1> 在上面的例子中,存储过程返回2个结果集Table,Table1(这个结果集计数可能有所不同)请告诉我如何使用XSLT在同一工作簿中dynamic创build工作表。 提前致谢..

将XSLT数字单元格输出修改为string

我正在使用XSLT模板将FileMaker的某些输出转换并格式化为Excel。 它适用于除一列之外的所有人。 数据是数字,但必须以NN.NN格式输出为string。 数据字段的input方式如04.13,但输出到Excel时,显示为4.13。 在某些情况下,用户input04 13(正确的outout正确,因为它不能被parsing为一个数字),但用户已经正确地input数据到filemaker(该字段是文本),即04.13,我需要确保输出数据保持正确的格式。 我已经尝试了以下,但它似乎没有像预期的那样工作 – 输出文件仍然显示列值作为数字,即失去了前导零: <xsl:choose> <xsl:when test="$xlFieldName='d_Oracle_Task_Code'"> <xsl:variable name="OracleTaskCode" select="fmp:DATA" /> <xsl:value-of select='format-number(OracleTaskCode, "00.00")' /> </xsl:when> </xsl:choose> 我不担心input缺less小数点分隔符的情况,只能确保将值输出为文本。

XSLT 2.0:删除xmlns属性

我有一个问题,Microsoft Excel需要内联格式化文本的特定格式,以便Data元素具有xmlns“ http://www.w3.org/TR/REC-html40 ”,但子元素(Font和B)没有定义的名称空间: <Cell> <ss:Data xmlns="http://www.w3.org/TR/REC-html40" ss:Type="String" xml:space="preserve"> <Font>normal text</Font> <B>bold text</B> <Font Color="#FF0000">red text</Font> </ss:Data> </Cell> 如果任何xmlns属性添加到字体或B,它们在Microsoft Excel中不能正确呈现。 我有以下源XML: <?xml version="1.0" encoding="UTF-8"?> <document> <text>normal text</text> <b>bold text</b> <red>red text</red> </document> 我的XSLT文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:svg="http://www.w3.org/2000/svg" version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="urn:schemas-microsoft-com:office:spreadsheet"> <xsl:output method="xml" omit-xml-declaration="yes" encoding="utf-8" version="1.0"/> <xsl:template match="/"> <xsl:value-of disable-output-escaping="yes" […]

XSLT从两个不同的来源(XML文件和Excel工作表)

有没有办法让我的xslt文件从两个不同的来源获得input? 一个来源是一个XML文件,另一个来源是一个Excel工作表。 我需要从他们两个获取数据。 例如,我有这个xslt : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="Data/AAA"> <xsl:for-each select="."> <Data xmlns="MyProtocol.xsd"> <BBB> <Id><xsl:value-of select="Id"/></Id> <Timestamp><xsl:value-of select="Timestamp"/></Timestamp> <xsl:if test="Transfer"> <Transfer><xsl:value-of select="Transfer"/></Transfer> </xsl:if> <Code>0</Code> <xsl:for-each select="Sequence/Number"> <Result> <Number><xsl:value-of select="."/></Number> <Code>0</Code> </Result> </xsl:for-each> </BBB> </Data> </xsl:for-each> </xsl:template> </xsl:stylesheet> Excel工作表: AB 1 Number | Code ———————– 2 5556667777 1 3 […]