You’re trying to parse non-XML content with XSL. Why?
<xsl:value-of select="@path"/>
is intended to operate on something like this:
<element path="a path"/>
In that case, the value would be a path
.
You can write XSL to parse these strings, but I recommend you find another way, such as parsing the string with Java and then writing XML with dom4j or JDOM.
If you’re really hung up on using XSL for this, here’s a simple stylesheet that gives an idea of how to proceed:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="root">
<xsl:variable name="href" select="substring-before(substring-after(text(), 'href="'), '"')" />
<xsl:variable name="path" select="substring-before(substring-after(text(), 'path="'), '"')" />
<a href="{$href}"><xsl:value-of select="$path" /></a>
</xsl:template>
</xsl:stylesheet>
Not too pleasant, as you can see.
When run on this document:
<root>
/**
* @parser
* path="/helloworld"
* href="/helloworld"
*
**/
</root>
It produces this output:
<?xml version="1.0" encoding="UTF-8"?>
<a href="/helloworld">/helloworld</a>
If you’re serious about continuing, I’d recommend the more sophisticated technique of writing a named template that you can call repeatedly to parse out the information you want. Example:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template name="parse-attribute">
<xsl:param name="name" />
<xsl:value-of select="substring-before(substring-after(text(), concat($name, '="')), '"')" />
</xsl:template>
<xsl:template match="root">
<xsl:variable name="href"><xsl:call-template name="parse-attribute"><xsl:with-param name="name" select="'href'" /></xsl:call-template></xsl:variable>
<xsl:variable name="path"><xsl:call-template name="parse-attribute"><xsl:with-param name="name" select="'path'" /></xsl:call-template></xsl:variable>
<a href="{$href}"><xsl:value-of select="$path" /></a>
</xsl:template>
</xsl:stylesheet>