Je l'entrée XML suivantajouter namespace + préfixe XML en utilisant XSLT
<Documents>
<Document>
<Prop>
<Name>FileNameField.BookingCentre</Name>
<Value>SG</Value>
</Prop>
<Prop>
<Name>FileNameField.MainType</Name>
<Value>CRE</Value>
</Prop>
<Prop>
<Name>FileNameField.SubType</Name>
<Value>CRR</Value>
</Prop>
<Prop>
<Name>FileNameField.AccountNo</Name>
<Value>8888888</Value>
</Prop>
<Prop>
<Name>FileNameField.Date</Name>
<Value>20140507</Value>
</Prop>
<Prop>
<Name>FileNameField.Time</Name>
<Value>183911</Value>
</Prop>
<Prop>
<Name>ServerIP</Name>
<Value>11.111.111.11</Value>
</Prop>
<Prop>
<Name>PhysicalLocation</Name>
<Value>AA</Value>
</Prop>
<Prop>
<Name>Destination Path</Name>
<Value>C:\Folder</Value>
</Prop>
<Prop>
<Name>File Name</Name>
<Value>SG_CRE_CRR_8888888_20140326172922.tif</Value>
</Prop>
<File>SG_CRE_CRR_8888888_20140326172922.tif</File>
</Document>
</Documents>
Et je besoin de ce devenir
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ad:AcceptDataInfo xmlns:ad="example.com">
<ad:ServerIP>11.111.111.11</ad:ServerIP>
<ad:FilePath>\\11.111.111.11\Hardcoded folder\SG\CRE\CRR</ad:FilePath>
<ad:FileName>SG_CRE_CRR_888888_20140326172922.tif</ad:FileName>
<ad:XMLFilePath>\\11.111.111.11\Hardcoded folder\XML</ad:XMLFilePath>
<ad:XMLFileName>SG_CRE_CRR_888888_20140326172922.XML</ad:XMLFileName>
<ad:PhysicalLocation>AA</ad:PhysicalLocation>
<ad:BookingCentre>SG</ad:BookingCentre>
<ad:MainType>CRE</ad:MainType>
<ad:SubType>CRR</ad:SubType>
<ad:AccountNo>8888888</ad:AccountNo>
<ad:Date>20140507</ad:Date>
<ad:Time>183911</ad:Time>
</ad:AcceptDataInfo>
Pour votre information,
la balise de sortie se composent de la valeur dans ServerIP, FileNameField.BookingCentre, FileNameField.MainType, FileNameField.SubType
le La balise put est constituée de la valeur de ServerIP, les autres sont codées en dur uniquement.
la balise de sortie se composent de la valeur dans le champ Nom du fichier, mais l'extension a changé .xml
la balise d'entrée: Chemin de destination, et le fichier sont mis au rebut dans le fichier XML de sortie.
Voici mon scrap XSLT pour référence, noté qu'il est loin d'être complet. Quelqu'un peut-il m'aider? Je vous remercie.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ad="test">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" standalone="yes" />
<xsl:strip-space elements="*"/>
<!-- Copy Everything -->
<xsl:template match="/">
<ad:AcceptDataInfo xmlns:ad="example.com">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</ad:AcceptDataInfo>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match= "Name[text()='FileNameField.Time']">
<ad:Time>
<xsl:value-of select="FileNameField.Time"/>
</ad:Time>
</xsl:template>
<xsl:template match="Value[count(.|((//Value)[1])) = 1]">
<index id="FilePath">
<xsl:apply-templates />
</index>
</xsl:template>
<xsl:template match="Name"/>
<xsl:template match="Documents/Document/Prop">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="Documents/Document">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="Documents">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
</xsl:stylesheet>