XMLException unsupported URI scheme 'http'

Hi everyone!
I am trying to apply an .xslt template to a .xml file in order to obtain a string with parsed data.
Still get the same XMLException. error numer: 67, msg:unsupported URI scheme ‘http’, in the Transform method.

The code is:

Dim CadenaO As String Dim f As FolderItem f = GetFolderItem("C:\\ECONTROL\\SAT\\cadenaoriginal_3_2.xslt") Dim plantillaXML As New XmlDocument plantillaXML.LoadXml( f ) CadenaO = xmlCFD.Transform(plantillaXML.ToString) Return CadenaO

Any idea what i am doing wrong?

You’re doing it backwards. You’re actually using the XML to translate the xslt file. Try this instead:

[code] Dim CadenaO As String
Dim f As FolderItem
f = GetFolderItem(“C:\ECONTROL\SAT\cadenaoriginal_3_2.xslt”)
// Read the XSLT file into a string
dim tis as textinputstream = textinputstream.open(f)
dim xslt as string = tis.readall
tis.close

f = GetFolderItem(“C:\ECONTROL\SAT\test.xml”) // Put your XML file path here
Dim plantillaXML As New XmlDocument
plantillaXML.LoadXml( f )
CadenaO = xmlCFD.Transform(xslt)
Return CadenaO[/code]

sometimes, I get an error with the first lines of the xml representing an html file
in a 4th dimension structure xml file for example begins with :

[code]<?xml version="1.0" encoding="UTF-8"?>

... [/code] the doctype tag gives me an exception error, because the dtd link is not parsed correctly (?) so I simply remove this first tag with this : [code] dim rx as new RegEx rx.SearchPattern = "(?mi-Us)^.*http://www.4d.com.*$\ " rx.ReplacementPattern = "" dim rxOptions as RegExOptions = rx.Options rxOptions.LineEndType = 4 rxOptions.ReplaceAllMatches = true dim replacedText as string = rx.Replace( theXML ) [/code] and then the "replacedText" is accepted by xojo xml methods. [code] Try Dim xml As New XmlDocument(replacedText) ... [/code]

Greg O, thank you for your reply!

This part of the code works fine:

Dim CadenaO As String Dim f As FolderItem f = GetFolderItem("C:\\ECONTROL\\SAT\\cadenaoriginal_3_2.xslt") // Read the XSLT file into a string dim tis as textinputstream = textinputstream.open(f) dim xslt as string = tis.readall tis.close

But on this part i get some errors:

f = GetFolderItem("C:\\ECONTROL\\SAT\\test.xml") // Put your XML file path here Dim plantillaXML As New XmlDocument plantillaXML.LoadXml( f ) CadenaO = xmlCFD.Transform(xslt) Return CadenaO

what is the test.xml file for? it is not used in the transform , right?
if i run it, i get an error in line : plantillaXML.LoadXml( f ) because i dont have a test.xml file?

if i comment the first 3 lines as you see here:

'f = GetFolderItem("C:\\ECONTROL\\SAT\\test.xml") // Put your XML file path here 'Dim plantillaXML As New XmlDocument 'plantillaXML.LoadXml( f ) CadenaO = xmlCFD.Transform(xslt) Return CadenaO
i get the same error from the beggining msg:unsupported URI scheme ‘http’, in the Transform method.

Any suggestion/comment is welcome.

The test.xml file is the xml that you’re trying to transform. If you’ve got it stored in a String already, put that variable in the LoadXML method instead. Now when I copied your code, I didn’t look close enough at your Transform call. It should have been:

CadenaO = plantillaXML.Transform(xslt)

Greg,
I get the same error i was getting (unsupported URI scheme ‘http’)
perhaps if i give complete data, the following is the xml file:

<?xml version="1.0"?> <cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd" version="3.2" serie="A" folio="" fecha="2016-03-14 11:50:19" formaDePago="Una sola exhibicin" subTotal="332.4" total="332.4" tipoDeComprobante="ingreso" metodoDePago="efectivo" LugarExpedicion="Matriz" noCertificado="20001000000100005867" certificado="MIIEdDCCA1ygAwIBAgIUMjAwMDEwMDAwMDAxMDAwMDU4NjcwDQYJKoZIhvcNAQEF&#13;&#10;BQAwggFvMRgwFgYDVQQDDA9BLkMuIGRlIHBydWViYXMxLzAtBgNVBAoMJlNlcnZp&#13;&#10;Y2lvIGRlIEFkbWluaXN0cmFjacOzbiBUcmlidXRhcmlhMTgwNgYDVQQLDC9BZG1p&#13;&#10;bmlzdHJhY2nDs24gZGUgU2VndXJpZGFkIGRlIGxhIEluZm9ybWFjacOzbjEpMCcG&#13;&#10;CSqGSIb3DQEJARYaYXNpc25ldEBwcnVlYmFzLnNhdC5nb2IubXgxJjAkBgNVBAkM&#13;&#10;HUF2LiBIaWRhbGdvIDc3LCBDb2wuIEd1ZXJyZXJvMQ4wDAYDVQQRDAUwNjMwMDEL&#13;&#10;MAkGA1UEBhMCTVgxGTAXBgNVBAgMEERpc3RyaXRvIEZlZGVyYWwxEjAQBgNVBAcM&#13;&#10;CUNveW9hY8OhbjEVMBMGA1UELRMMU0FUOTcwNzAxTk4zMTIwMAYJKoZIhvcNAQkC&#13;&#10;DCNSZXNwb25zYWJsZTogSMOpY3RvciBPcm5lbGFzIEFyY2lnYTAeFw0xMjA3Mjcx&#13;&#10;NzAyMDBaFw0xNjA3MjcxNzAyMDBaMIHbMSkwJwYDVQQDEyBBQ0NFTSBTRVJWSUNJ&#13;&#10;T1MgRU1QUkVTQVJJQUxFUyBTQzEpMCcGA1UEKRMgQUNDRU0gU0VSVklDSU9TIEVN&#13;&#10;UFJFU0FSSUFMRVMgU0MxKTAnBgNVBAoTIEFDQ0VNIFNFUlZJQ0lPUyBFTVBSRVNB&#13;&#10;UklBTEVTIFNDMSUwIwYDVQQtExxBQUEwMTAxMDFBQUEgLyBIRUdUNzYxMDAzNFMy&#13;&#10;MR4wHAYDVQQFExUgLyBIRUdUNzYxMDAzTURGUk5OMDkxETAPBgNVBAsTCFVuaWRh&#13;&#10;ZCAxMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2TTQSPONBOVxpXv9wLYo8&#13;&#10;jezBrb34i/tLx8jGdtyy27BcesOav2c1NS/Gdv10u9SkWtwdy34uRAVe7H0a3VMR&#13;&#10;LHAkvp2qMCHaZc4T8k47Jtb9wrOEh/XFS8LgT4y5OQYo6civfXXdlvxWU/gdM/e6&#13;&#10;I2lg6FGorP8H4GPAJ/qCNwIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQE&#13;&#10;AwIGwDANBgkqhkiG9w0BAQUFAAOCAQEATxMecTpMbdhSHo6KVUg4QVF4Op2IBhiM&#13;&#10;aOrtrXBdJgzGotUFcJgdBCMjtTZXSlq1S4DG1jr8p4NzQlzxsdTxaB8nSKJ4KEMg&#13;&#10;IT7E62xRUj15jI49qFz7f2uMttZLNThipunsN/NF1XtvESMTDwQFvas/Ugig6qwE&#13;&#10;fSZc0MDxMpKLEkEePmQwtZD+zXFSMVa6hmOu4M+FzGiRXbj4YJXn9Myjd8xbL/c+&#13;&#10;9UIcrYoZskxDvMxc6/6M3rNNDY3OFhBK+V/sPMzWWGt8S1yjmtPfXgFs1t65AZ2h&#13;&#10;cTwTAuHrKwDatJ1ZPfa482ZBROAAX1waz7WwXp0gso7sDCm2/yUVww==&#13;&#10;" sello=""> <cfdi:Emisor xmlns:cfdi="%22http://www.sat.gob.mx/cfd/3%22" nombre="ECOLOGISTIX DEL VALLE DE TEHUACAN S. DE R.L. DE C.V." rfc="EVT081114KB4"> <cfdi:DomicilioFiscal calle="AV. DEL AGAVE #106" codigoPostal="75820" colonia="BARRIO DE STA. CLARA" estado="PUEBLA" municipio="SANTIAGO MIAHUATLAN" pais="MEXICO"/> <RegimenFiscal xmlns="%22http://www.sat.gob.mx/cfd/3%22" Regimen="Regimen general de ley"/> </cfdi:Emisor> <cfdi:Receptor xmlns:cfdi="%22http://www.sat.gob.mx/cfd/3%22" nombre="CLIENTE DESCONOCIDO" rfc="PROVDES"> <cfdi:Domicilio calle="N/D" codigoPostal="0" estado="PUEBLA" municipio="TEHUACAN" pais="MEXICO"/> </cfdi:Receptor> <cfdi:Conceptos xmlns:cfdi="%22http://www.sat.gob.mx/cfd/3%22"> <cfdi:Concepto cantidad="55.4" descripcion="PLASTICO RECICLABLE REVUELTO RECOLECTADO" unidad="kg" valorUnitario="6" importe="332.4"/> </cfdi:Conceptos> <cfdi:Impuestos xmlns:cfdi="%22http://www.sat.gob.mx/cfd/3%22"> <cfdi:Traslados> <cfdi:Traslado impuesto="IVA" tasa="16.00" importe="0"/> </cfdi:Traslados> </cfdi:Impuestos> <cfdi:Complemento xmlns:cfdi="%22http://www.sat.gob.mx/cfd/3%22"> </cfdi:Complemento> </cfdi:Comprobante>

My code is:

Dim CadenaO As String Dim f As FolderItem f = GetFolderItem("C:\\ECONTROL\\SAT\\cadenaoriginal_3_2.xslt") // Read the XSLT file into a string dim tis as textinputstream = textinputstream.open(f) dim xslt as string = tis.readall tis.close Dim plantillaXML As New XmlDocument plantillaXML.LoadXml( XMLString ) CadenaO = plantillaXML.Transform(xslt) Return CadenaO

Any suggestion of what i am doing wrong?

What does cadenaoriginal_3_2.xslt contain?

i have to send it in mor than one post:

the xls file:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version=“2.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:fn=“http://www.w3.org/2005/xpath-functions” xmlns:cfdi=“http://www.sat.gob.mx/cfd/3” xmlns:ecc=“http://www.sat.gob.mx/ecc” xmlns:psgecfd=“http://www.sat.gob.mx/psgecfd” xmlns:donat=“http://www.sat.gob.mx/donat” xmlns:divisas=“http://www.sat.gob.mx/divisas” xmlns:detallista=“http://www.sat.gob.mx/detallista” xmlns:ecb=“http://www.sat.gob.mx/ecb” xmlns:implocal=“http://www.sat.gob.mx/implocal” xmlns:terceros=“http://www.sat.gob.mx/terceros” xmlns:iedu=“http://www.sat.gob.mx/iedu” xmlns:ventavehiculos=“http://www.sat.gob.mx/ventavehiculos” xmlns:pfic=“http://www.sat.gob.mx/pfic” xmlns:tpe=“http://www.sat.gob.mx/TuristaPasajeroExtranjero” xmlns:leyendasFisc=“http://www.sat.gob.mx/leyendasFiscales”>


<xsl:output method=“text” version=“1.0” encoding=“UTF-8” indent=“no”/>

<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/2/cadenaoriginal_2_0/utilerias.xslt”/>

<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/ecc/ecc.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/psgecfd/psgecfd.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/donat/donat11.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/divisas/divisas.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/ecb/ecb.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/detallista/detallista.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/terceros/terceros11.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/iedu/iedu.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/ventavehiculos/ventavehiculos.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/pfic/pfic.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/TuristaPasajeroExtranjero/TuristaPasajeroExtranjero.xslt”/>
<xsl:include href=“http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xslt”/>

<xsl:template match="/">|<xsl:apply-templates select="/cfdi:Comprobante"/>||</xsl:template>

<xsl:template match=“cfdi:Comprobante”>

<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@version"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@fecha"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@tipoDeComprobante"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@formaDePago"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@condicionesDePago"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@subTotal"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@descuento"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@TipoCambio"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@Moneda"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@total"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@metodoDePago"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@LugarExpedicion"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@NumCtaPago"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@FolioFiscalOrig"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@SerieFolioFiscalOrig"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@FechaFolioFiscalOrig"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@MontoFolioFiscalOrig"/>
</xsl:call-template>

<xsl:apply-templates select="./cfdi:Emisor"/>
<xsl:apply-templates select="./cfdi:Receptor"/>
<xsl:apply-templates select="./cfdi:Conceptos"/>
<xsl:apply-templates select="./cfdi:Impuestos"/>
<xsl:apply-templates select="./cfdi:Complemento"/>
</xsl:template>

<xsl:template match=“cfdi:Emisor”>

<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@rfc"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@nombre"/>
</xsl:call-template>

<xsl:apply-templates select="./cfdi:DomicilioFiscal"/>
<xsl:if test="./cfdi:ExpedidoEn">
<xsl:call-template name=“Domicilio”>
<xsl:with-param name=“Nodo” select="./cfdi:ExpedidoEn"/>
</xsl:call-template>
</xsl:if>
<xsl:for-each select="./cfdi:RegimenFiscal">
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@Regimen"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>

<xsl:template match=“cfdi:Receptor”>

<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@rfc"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@nombre"/>
</xsl:call-template>

<xsl:if test="./cfdi:Domicilio">
<xsl:call-template name=“Domicilio”>
<xsl:with-param name=“Nodo” select="./cfdi:Domicilio"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template match=“cfdi:Conceptos”>

<xsl:for-each select="./cfdi:Concepto">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>

<xsl:template match=“cfdi:Impuestos”>
<xsl:for-each select="./cfdi:Retenciones/cfdi:Retencion">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@totalImpuestosRetenidos"/>
</xsl:call-template>
<xsl:for-each select="./cfdi:Traslados/cfdi:Traslado">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@totalImpuestosTrasladados"/>
</xsl:call-template>
</xsl:template>

<xsl:template match=“cfdi:Retencion”>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@impuesto"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@importe"/>
</xsl:call-template>
</xsl:template>

<xsl:template match=“cfdi:Traslado”>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@impuesto"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@tasa"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@importe"/>
</xsl:call-template>
</xsl:template>

<xsl:template match=“cfdi:Complemento”>
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>

<xsl:template match=“cfdi:Concepto”>

<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@cantidad"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@unidad"/>
</xsl:call-template>
<xsl:call-template name=“Opcional”>
<xsl:with-param name=“valor” select="./@noIdentificacion"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@descripcion"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@valorUnitario"/>
</xsl:call-template>
<xsl:call-template name=“Requerido”>
<xsl:with-param name=“valor” select="./@importe"/>
</xsl:call-template>

here continues the xsl :

	<!--
		Manejo de los distintos sub nodos de informacin aduanera de forma indistinta 
		a su grado de dependencia
	-->
	<xsl:for-each select=".//cfdi:InformacionAduanera">
		<xsl:apply-templates select="."/>
	</xsl:for-each>
	<!-- Llamada al manejador de nodos de Cuenta Predial en caso de existir -->
	<xsl:if test="./cfdi:CuentaPredial">
		<xsl:apply-templates select="./cfdi:CuentaPredial"/>
	</xsl:if>
	<!-- Llamada al manejador de nodos de ComplementoConcepto en caso de existir -->
	<xsl:if test="./cfdi:ComplementoConcepto">
		<xsl:apply-templates select="./cfdi:ComplementoConcepto"/>
	</xsl:if>
</xsl:template>
<!-- Manejador de nodos tipo Informacin Aduanera -->
<xsl:template match="cfdi:InformacionAduanera">
	<!-- Manejo de los atributos de la informacin aduanera -->
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@numero"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@fecha"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@aduana"/>
	</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Informacin CuentaPredial -->
<xsl:template match="cfdi:CuentaPredial">
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@numero"/>
	</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo ComplementoConcepto -->
<xsl:template match="cfdi:ComplementoConcepto">
	<xsl:for-each select="./*">
		<xsl:apply-templates select="."/>
	</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Domicilio fiscal -->
<xsl:template match="cfdi:DomicilioFiscal">
	<!-- Iniciamos el tratamiento de los atributos del Domicilio Fiscal -->
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@calle"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@noExterior"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@noInterior"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@colonia"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@localidad"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="./@referencia"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@municipio"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@estado"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@pais"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="./@codigoPostal"/>
	</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Domicilio -->
<xsl:template name="Domicilio">
	<xsl:param name="Nodo"/>
	<!-- Iniciamos el tratamiento de los atributos del Domicilio  -->
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@calle"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@noExterior"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@noInterior"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@colonia"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@localidad"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@referencia"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@municipio"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@estado"/>
	</xsl:call-template>
	<xsl:call-template name="Requerido">
		<xsl:with-param name="valor" select="$Nodo/@pais"/>
	</xsl:call-template>
	<xsl:call-template name="Opcional">
		<xsl:with-param name="valor" select="$Nodo/@codigoPostal"/>
	</xsl:call-template>
</xsl:template>

</xsl:stylesheet>

Any advice?

Xojo implementation of XSLT has troubles with the include instruction and for sure can’t understand a remote file.

You should try some local include (maybe in same folder) or copy the templates from the external files in your transform document.

About your code:
You don’t need to load the string and then create the document, XMLDocument and also XmlStyleSheet can load them from the file directly

Any way you can solve this problem in as easy way (maybe you can cache the new xslt to avoid long elaboration time)

//The file with your original XSLT
Dim f As FolderItem
f = GetFolderItem("C:\\ECONTROL\\SAT\\cadenaoriginal_3_2.xslt")

//Load it in as temp XML document
dim xmlTemp as new XmlDocument
xmlTemp.LoadXml(f)

//Query the document for include with the href attribute
dim xq as XmlNodeList
xq=xmlTemp.DocumentElement.Xql("xsl:include[@href]")

//How many nodes?
dim n as integer=xq.Length-1

//Prepare an http socket to download the files
dim htp as new HTTPSocket

//Foreach node we download the document then append the new nodes removing the original one
//Since we remove node we have to count from last to first
for i as integer=n DownTo 0
    //Take the node and its href attribute
    dim xn as XmlNode=xq.Item(i)
    dim href as String=xn.GetAttribute("href")
   
   //Load the remote document
   dim s as String=htp.Get(href,10)

   //if there is a reply (otherwise we will fail)
   if s<>"" then
      //Prepare a new temp xml doc
      dim xmlExt as new XmlDocument
      xmlExt.LoadXml(s)

     //Query for the templates
      dim xqExt as XmlNodeList=xmlExt.DocumentElement.Xql("xsl:template")

      //How many?
      dim nExt as integer=xqExt.Length-1

     //Take the original node parent node
      dim xParent as XmlNode=xn.Parent
 
      //A node to be imported
      dim pi as XmlNode

      //For each external template 
      for iExt as integer=nExt DownTo 0
        //Import the external template
        pi=xmlTemp.ImportNode(xqq.Item(ii), true)

        //Append it to the document (parent include node)
        xParent.AppendChild pi 
      Next
     
      //Remove the original node
      xParent.RemoveChild(xn)
    end if
next 

//Load the new stylesheet 
dim xs as new XmlStyleSheet
xs.LoadXml xmlTemp.ToString

//Load the doc to be transformed
Dim plantillaXML As New XmlDocument
plantillaXML.LoadXml( XMLString )

//Do the transormation
CadenaO = plantillaXML.Transform(xs)
Return CadenaO

As said, it will take a while to download all the document but it will work

Antonio Rinaldi
Thank you for the reply.
What do you mean by “i should try some local include (maybe in same folder?) or copy templates from external files in your transform document”?
Could you expain it more detailed?
regards,

The copy can be done with the provided code. Remember to save the xs document in order to don’t download the single parts again.

xsl:include is a command to let introduce nodes in you xslt.
If the plugin can’t deal with remote files you can:
a)import them manually reading the href address, removing the node and pasting only the transform nodes (not the entire doc)
a1)Use the provided document
b) try to change the remote href in reference for local files. But maybe the XSLT has no idea where it is, so it can’t load / find the doc. The suggestion to use the same folder is just a test that can be done, maybe the plugin can’t navigate in the folders but can see in the same folder…

Thanks Antonio, it works!

i probe all solutions but do not work

my code example

can you help me to check what is wrong