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>
哪個處理器能做到這一點? –
我們可以看到您的xslt是否對您的帖子非常重要?在''和''標籤中聲明後,我很感興趣,看看信箱是如何改變的,因爲我無法複製。 –
Parfait
嗨Michael.hor257k和Parfait - 我已經添加了XSLT。正如我現在提到的,我只是通過I.E10進行處理 - 但後來我將把它移植到Linux中並通過xsltproc運行。 乾杯。 – Davinod