I have this xml

<?xml-stylesheet type="text/xsl" href="almacen1.xsl"?>
    <producto id="p0001">
        <nombre>SET DE LLAVES HEXÁGONAS</nombre>
        <marca pagina="www.suconel.com">>SUCONEL</marca>
    <producto id="p0002">
        <nombre>Llave para tubo de 8"</nombre>
        <marca pagina="www.accesa.com.uy">ACCESA</marca>

And they ask me to put functional links using the links in the xml, but when I click on the link, it shows this: Error loading style sheet: XPath analysis failed: ':' was not expected

My xslt code is this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
                    <xsl:for-each select="//producto">
                        <a target="_blank">
                            <xsl:attribute name="href">
                                <xsl:value-of select="http://{marca/@pagina}"/>
                            <xsl:value-of select="marca/@pagina"/>

Anyone knows how?

2 Answers 2


I fixed it. I put: <xsl:attribute name="href">http://<xsl:value-of select="marca/@pagina"/><xsl:attribute> and it worked.

  • Don't forget to accept your own answer so future users can find the question as answered.
    – willman
    Commented Jan 26, 2020 at 20:34

You have to escape/encode those values to to make it XSL-safe. If you are using XSL 2.0, you can use encode-for-uri.

Not the answer you're looking for? Browse other questions tagged or ask your own question.