Generate an output string modified by a catalog
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 25
- Joined: Sun Apr 22, 2018 10:17 pm
Generate an output string modified by a catalog
Because I want to pass a string containing an absolute route to a file as parameter to a Xslt Template which open the document specified in the parameter, I need a way of converting such string into a route using a catalog
I explain in Code
currently I have an Uri like this "https://www.bancaonline/banco_santander"
I need convert it into "file:/c:/bancos/santander/clientes.xml"
so I introduce the change in catalog
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteURI uriStartString="https://www.bancaonline/banco_santander"
rewritePrefix="file:/c:/bancos/santander/clientes.xml" />
</catalog>
later I create in XSLT file a variable route with the first URI in order to use "$route" as parameter
<xsl:variable name="route" select="https://www.bancaonline/banco_santander" />
but I receive the following error Unexpected token ":" beyond end of expression I think that the Uri is not normalized, could you help me to get the variable route working and receiving the correct Uri by the catalog.
Best Regards
Francisco
I explain in Code
currently I have an Uri like this "https://www.bancaonline/banco_santander"
I need convert it into "file:/c:/bancos/santander/clientes.xml"
so I introduce the change in catalog
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteURI uriStartString="https://www.bancaonline/banco_santander"
rewritePrefix="file:/c:/bancos/santander/clientes.xml" />
</catalog>
later I create in XSLT file a variable route with the first URI in order to use "$route" as parameter
<xsl:variable name="route" select="https://www.bancaonline/banco_santander" />
but I receive the following error Unexpected token ":" beyond end of expression I think that the Uri is not normalized, could you help me to get the variable route working and receiving the correct Uri by the catalog.
Best Regards
Francisco
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Generate an output string modified by a catalog
Hi Francisco,
How about if you post a small sample (XSLT + XML + XML catalog) to better exemplify the situation? Because I have no idea at what line in the stylesheet the error "Unexpected token ":" beyond end of expression " occurs.
Regards,
Radu
How about if you post a small sample (XSLT + XML + XML catalog) to better exemplify the situation? Because I have no idea at what line in the stylesheet the error "Unexpected token ":" beyond end of expression " occurs.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 25
- Joined: Sun Apr 22, 2018 10:17 pm
Re: Generate an output string modified by a catalog
I Detail the Error
XSLT File
<xsl:template match="/">
<xsl:variable name="route" select="https://www.bancaonline/banco_santander/clientes.xml" />
<!-- here yields the error Unexpected token ":" beyond end of expression -->
<xsl:result-document href="{$rutaDocumentoSalida}" method="xml" encoding="UTF-8" indent="yes" >
<xsl:apply-templates select="document($rutaDocumentoEntrada)" >
<xsl:with-param name="uriPuntoEntrada" select="$route" tunnel="yes" />
</xsl:apply-templates>
</xsl:result-document>
</xsl:template>
The Catalog
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteURI uriStartString="https://www.bancaonline/banco_santander" rewritePrefix="file:/c:/bancos/santander/" />
</catalog>
Regards
XSLT File
<xsl:template match="/">
<xsl:variable name="route" select="https://www.bancaonline/banco_santander/clientes.xml" />
<!-- here yields the error Unexpected token ":" beyond end of expression -->
<xsl:result-document href="{$rutaDocumentoSalida}" method="xml" encoding="UTF-8" indent="yes" >
<xsl:apply-templates select="document($rutaDocumentoEntrada)" >
<xsl:with-param name="uriPuntoEntrada" select="$route" tunnel="yes" />
</xsl:apply-templates>
</xsl:result-document>
</xsl:template>
The Catalog
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteURI uriStartString="https://www.bancaonline/banco_santander" rewritePrefix="file:/c:/bancos/santander/" />
</catalog>
Regards
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Generate an output string modified by a catalog
Hi,
When you want to have an XSLT variable which has as value a string literal you need to surround the literal with extra simple quotes like this:
Regards,
Radu
When you want to have an XSLT variable which has as value a string literal you need to surround the literal with extra simple quotes like this:
Code: Select all
<xsl:variable name="route" select="'https://www.bancaonline/banco_santander/clientes.xml'" />
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 25
- Joined: Sun Apr 22, 2018 10:17 pm
Re: Generate an output string modified by a catalog
Thanks Radu, now it works, but I see that the catalog only works when using document
so <xsl:variable name="route" select="document('https://www.bancaonline/banco_santander/clientes.xml"')" />
is transformed into file:/c:/bancos/santander/clientes.xml
but <xsl:variable name="route" select="'http://www.animales/domesticos/europa/perros.xml'" /> is not transformed
and my question is if document function is allways required for the transformation or there are other XSL commands or functions that can be used too
for the catalog transformation.
Regards
so <xsl:variable name="route" select="document('https://www.bancaonline/banco_santander/clientes.xml"')" />
is transformed into file:/c:/bancos/santander/clientes.xml
but <xsl:variable name="route" select="'http://www.animales/domesticos/europa/perros.xml'" /> is not transformed
and my question is if document function is allways required for the transformation or there are other XSL commands or functions that can be used too
for the catalog transformation.
Regards
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Generate an output string modified by a catalog
Hi,
Good question.
I've used in the past quite a lot the capabilities of the document() function to automatically resolve through the XML catalog, but from what I know the XSLT resolve-ur() function does not although maybe it should, I asked a question about this on the Saxonica (XSLT Processor) issues list:
https://saxonica.plan.io/issues/5277
I'm not sure why you want to pass that URL reference through the XML catalog and keep it as a plain string, maybe you can elaborate.
Anyway you could probably do something like this as a workaround:
Also some resources about XSLT training:
https://blog.oxygenxml.com/topics/xslt_training.html
Regards,
Radu
Good question.
I've used in the past quite a lot the capabilities of the document() function to automatically resolve through the XML catalog, but from what I know the XSLT resolve-ur() function does not although maybe it should, I asked a question about this on the Saxonica (XSLT Processor) issues list:
https://saxonica.plan.io/issues/5277
I'm not sure why you want to pass that URL reference through the XML catalog and keep it as a plain string, maybe you can elaborate.
Anyway you could probably do something like this as a workaround:
Code: Select all
<xsl:variable name="abc" select="base-uri(document('http://some/link/here'))"/>
https://blog.oxygenxml.com/topics/xslt_training.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service