2015-08-15 95 views
1

您好StackOverFlow社区,如何使XSL不将我的xsl:element和xsl:属性名称转换为小写?

我已经创建了一个简单的XSL来将XML文件转换为另一个。

输出XML文件需要遵循我从供应商处获得的架构,该架构描述了遵循camelCase标准的元素。

例如,我需要创建的元素:

<bfr5:remision> 
    <brf5:infoBasica folio="19190" refID="19190" rfcReceptor="TTTTT" rfcEmisor="SSSSS5"> 
    <infoEspecial valor="19190"></infoEspecial> 
    </brf5:infoBasica> 
</bfr5:remision> 

然而,当我跑我的XSL,它改变的元素和属性名全部为小写。

<bfr5:remision> 
    <brf5:infobasica folio="19190" refid="19190" rfcreceptor="TTTTT" rfcemisor="SSSSS5"> 
    <infoespecial valor="19190"></infoespecial> 
    </brf5:infobasica> 
</bfr5:remision> 

这是整个XSL文件:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"        xmlns:bfr5="http://www.buzonfiscal.com/ns/xsd/bf/remision/52"> 
<xsl:output omit-xml-declaration="yes" indent="yes"/> 

<xsl:template match="/"> 

    <xsl:element name="bfr5:Remision"> 

    <xsl:attribute name="version">5.2</xsl:attribute> 

    <!-- Required for InfoBasica --> 
    <xsl:variable name="custRegNo" select="/Document/Letter/Customer/custRegNo"/> 
    <xsl:variable name="invoiceNo" select="/Document/Letter/InvoiceDetails/InvoiceHeader/invoiceNo"/> 
    <xsl:variable name="folioNo"  select="/Document/Letter/InvoiceDetails/InvoiceHeader/folioAssign"/> 
    <xsl:variable name="asignaFolio">false</xsl:variable> 
    <xsl:variable name="lessorTaxId" select="/Document/Letter/LetterDetails/Lessor/lessorTaxId"/> 

    <!-- Required for InfoAdicional --> 
    <xsl:variable name="paymentType"  select="/Document/Letter/InvoiceDetails/InvoiceHeader/paymentType"/> 
    <xsl:variable name="subTotal"   select="/Document/Letter/InvoiceDetails/InvoiceHeader/totalDueWithLateCharge"/> 
    <xsl:variable name="total"    select="/Document/Letter/InvoiceDetails/InvoiceHeader/totalDueWithLateCharge"/> 
    <xsl:variable name="paymentMethod"  select="/Document/Letter/InvoiceDetails/InvoiceHeader/paymentMethod"/> 
    <xsl:variable name="invoiceType" select="/Document/Letter/InvoiceDetails/InvoiceHeader/invoiceType"/> 
    <xsl:variable name="expeditionPlace" select="/Document/Letter/InvoiceDetails/InvoiceHeader/expeditionPlace"/> 

    <!-- Required for Emisor --> 
    <xsl:variable name="regimen" select="'Régimen General De Ley Personas Morales'"/> 

    <!-- Required for DomicilioFiscal --> 
    <xsl:variable name="addressStreet" select="/Document/Letter/LetterDetails/Lessor/LessorAddress/addressStreetNameAndNumber"/> 
    <xsl:variable name="addressCity"  select="/Document/Letter/LetterDetails/Lessor/LessorAddress/addressCity"/> 
    <xsl:variable name="addressState"  select="/Document/Letter/LetterDetails/Lessor/LessorAddress/addressState"/> 
    <xsl:variable name="addressCountry" select="/Document/Letter/LetterDetails/Lessor/LessorAddress/addressCountry"/> 
    <xsl:variable name="addressZip"  select="/Document/Letter/LetterDetails/Lessor/LessorAddress/addressPostalCode"/> 

    <xsl:element name="bfr5:InfoBasica"> 

    <xsl:attribute name="rfcEmisor"><xsl:value-of select="$lessorTaxId"/></xsl:attribute>   
    <xsl:attribute name="rfcReceptor"><xsl:value-of select="$custRegNo"/></xsl:attribute>   
    <xsl:attribute name="refID"><xsl:value-of select="$invoiceNo"/></xsl:attribute>   
    <xsl:attribute name="folio"><xsl:value-of select="$folioNo"/></xsl:attribute>   
    <xsl:attribute name="asignaFolio"><xsl:value-of select="$asignaFolio"/></xsl:attribute> 

    <xsl:element name="InfoEspecial"> 
     <xsl:attribute name="atributo">Invoice Number</xsl:attribute>   
     <xsl:attribute name="valor"><xsl:value-of select="$invoiceNo"/></xsl:attribute>   
    </xsl:element>  
    </xsl:element> 

    <xsl:element name ="bfr5:InfoAdicional"> 

    <xsl:attribute name="formaDePago"><xsl:value-of select="$paymentType"/></xsl:attribute> 
    <xsl:attribute name="subTotal"><xsl:value-of select="$subTotal"/></xsl:attribute> 
    <xsl:attribute name="total"><xsl:value-of select="$total"/></xsl:attribute> 
    <xsl:attribute name="metodoDePago"><xsl:value-of select="$paymentMethod"/></xsl:attribute> 
    <xsl:attribute name="tipoDeComprobante"><xsl:value-of select="$invoiceType"/></xsl:attribute> 
    <xsl:attribute name="lugarExpedicion"><xsl:value-of select="$expeditionPlace"/></xsl:attribute> 

    </xsl:element> 

    <xsl:element name ="bfr5:Emisor">   
    <xsl:element name="bfr5:RegimenFiscal">   
     <xsl:attribute name="Regimen"><xsl:value-of select="$regimen"/></xsl:attribute>    
    </xsl:element>  
    </xsl:element> 

    <xsl:element name ="bfr5:DomicilioFiscal"> 

    <xsl:attribute name="calle"><xsl:value-of select="$addressStreet"/></xsl:attribute> 
    <xsl:attribute name="municipio"><xsl:value-of select="$addressCity"/></xsl:attribute> 
    <xsl:attribute name="estado"><xsl:value-of select="$addressState"/></xsl:attribute> 
    <xsl:attribute name="pais"><xsl:value-of select="$addressCountry"/></xsl:attribute> 
    <xsl:attribute name="codigoPostal"><xsl:value-of select="$addressZip"/></xsl:attribute> 


    </xsl:element> 

</xsl:element> 

我使用Internet Explorer 10来处理。稍后,我将把这些代码移植到Linux中,并使用$ xsltproc来运行它。

<bfr5:remision xmlns:bfr5="http://www.buzonfiscal.com/ns/xsd/bf/remision/52" version="5.2"> 
    <bfr5:infobasica folio="19190" refid="19190" rfcreceptor="XAXX010101000" rfcemisor="DLM131002M75" asignafolio="false"> 
    <infoespecial valor="19190" atributo="Invoice Number"></infoespecial> 
    <bfr5:infoadicional lugarexpedicion="Mexico DF" tipodecomprobante="ingreso" metododepago="Transferencia electrónica de fondos" total="2.00" subtotal="2.00" formadepago="Pago en una sola Exhibición"> 
     <bfr5:emisor> 
     <bfr5:regimenfiscal regimen="SCRAMBLE l De Ley Personas Morales"></bfr5:regimenfiscal> 
     <bfr5:domiciliofiscal codigopostal="111950" pais="MEXICO" estado="D.F" municipio="SCRAMBLED CITY" calle="SCRAMBLE ADDRESS"></bfr5:domiciliofiscal> 
     </bfr5:emisor> 
    </bfr5:infoadicional> 
</bfr5:infobasica> 
</bfr5:remision> 
+0

哪个处理器能做到这一点? –

+0

我们可以看到您的xslt是否对您的帖子非常重要?在''和''标签中声明后,我很感兴趣,看看信箱是如何改变的,因为我无法复制。 – Parfait

+0

嗨Michael.hor257k和Parfait - 我已经添加了XSLT。正如我现在提到的,我只是通过I.E10进行处理 - 但后来我将把它移植到Linux中并通过xsltproc运行。 干杯。 – Davinod

回答

1

好吧 - 这似乎是因为Internet Explorer发生。

我已将XSL和XML移植到Linux中,并通过xsltproc运行。它不再将元素和属性名称转换为小写字母。它现在保存我的camelCase。

Regards, Davi