来源输入
<SiebelMessage MessageId="1-18J35" IntObjectName="XRX R5 Letter Instance" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical"> <LetterInstance Id="1-1RUYIF" Language="ENU" TemplateType="SA"> <Field Value="CO Last Name" Datatype="String" Name="ContractingOfficerLastName"> </LetterInstance> </SiebelMessage>
预期结果:
<?xml version="1.0" encoding="UTF-8"?> <SiebelMessage MessageId="1-18J35" IntObjectName="XRX R5 Letter Instance" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical"> <LetterInstance Id="1-1RUYIF" Language="ENU" TemplateType="SA"> <ContractingOfficerLastName>CO Last Name</ContractingOfficerLastName> <PONumber>POTest000001</PONumber> </LetterInstance> </SiebelMessage>
这个XSL样式表:
原文链接:https://www.f2er.com/xml/292352.html<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="Field"> <xsl:element name="{@Name}"> <xsl:value-of select="@Value"/> </xsl:element> </xsl:template> </xsl:stylesheet>
应用于良好的输入:
<SiebelMessage MessageId="1-18J35" IntObjectName="XRX R5 Letter Instance" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical"> <LetterInstance Id="1-1RUYIF" Language="ENU" TemplateType="SA"> <Field Value="CO Last Name" Datatype="String" Name="ContractingOfficerLastName"/> </LetterInstance> </SiebelMessage>
生产:
<SiebelMessage MessageId="1-18J35" IntObjectName="XRX R5 Letter Instance" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical"> <LetterInstance Id="1-1RUYIF" Language="ENU" TemplateType="SA"> <ContractingOfficerLastName>CO Last Name</ContractingOfficerLastName> </LetterInstance> </SiebelMessage>
我不确定在哪里< PONumber>应该是从…生成的.