Reputation: 147
I am new to XSLT world and I want to know how can I match string like <mml:mtable class="ccvccvcvc">
actually I want to match the variable text ccvccvcvc
every time and copy it to use in the conversion.
The final result should be like:
<mml:mtable class="xxx">
<xsl:text>\begin{array}{xxx}</xsl:text><xsl:apply-templates/><xsl:text>\end{array}</xsl:text>
Upvotes: 1
Views: 481
Reputation: 163585
Your input "string" isn't a string, it's an XML element node. And your "output string" isn't a string, it's a fragment of XSLT program text. So I think your reference to regular expressions in the title suggests you are are confused about the XSLT processing model. Remember that XSLT is processing a tree of nodes as input to produce a tree of nodes as output.
I think Martin has probably guessed correctly what you need to do, but I suspect there may be a few gaps in your understanding of XSLT that you need to fix before you can get this working.
Upvotes: 0
Reputation: 167716
Try
<xsl:template match="mml:mtable[@class]">
<xsl:text>\begin{array}{</xsl:text>
<xsl:value-of select="@class"/>
<xsl:text>}</xsl:text>
<xsl:apply-templates/>
<xsl:text>\end{array}</xsl:text>
</xsl:template>
Upvotes: 1