xslt - Facing some attribute node issue -


i having following code on full length xslt, and, creates errors during transformation. error xpty0004: sequence of more 1 item not allowed first argument of matches()

<xsl:template match="par[@class='tablecaption']" exclude-result-prefixes="html"> <p class="caption1"> <xsl:variable name="n2" select="./text()|./*/text()"/> <xsl:attribute name="id"> <xsl:if test="matches($n2, '(table)\s(\d+|[a-z])(\.)(\d+)')"> <xsl:variable name="y2" select="replace($n2, '(table)\s(\d+|[a-z])(\.)(\d+)', '$4')"/>tab<xsl:value-of select="normalize-space(substring($y2, 1, 2))"/></xsl:if> </xsl:attribute> <strong><xsl:apply-templates/></strong></p> </xsl:template> 

what wrong here? pls

change variable n2 ./descendant::text()[1]

<xsl:template match="par[@class='tablecaption']" exclude-result-prefixes="html"> <p class="caption1"> <xsl:variable name="n2" select="./descendant::text()[1]"/> <xsl:attribute name="id"> <xsl:if test="matches($n2, '(table)\s(\d+|[a-z])(\.)(\d+)')"> <xsl:variable name="y2" select="replace($n2, '(table)\s(\d+|[a-z])(\.)(\d+)', '$4')"/>tab<xsl:value-of select="normalize-space(substring($y2, 1, 2))"/></xsl:if> </xsl:attribute> <strong><xsl:apply-templates/></strong></p> </xsl:template> 

with input

<root>     <par class="tablecaption"> table a.1 <bold>text2</bold></par> </root> 

it gets:

<root>     <p class="caption1" id="tab1"><strong> table a.1 <bold>text2</bold></strong></p> </root> 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -