[Home] [By Thread] [By Date] [Recent Entries]
llobash@xxxxxxxx wrote:
sure, sorry, more complete example:Your description isn't particularly clear, so I just gave you an example where it replaces scopecontent with what you stated previously (or what I thought you wanted). In the future, you will find that if you give the input (as you have above) and the output you want produced, you will get a better response. This will hopefully be enough to help you on your way. This solution will only work if you have cXX elements, it won't work if the 'c' is a 'd'. If you are using a processor that supports regex processing (one that supports XSLT 2.0 or one that supports the exslt regex functions) you could tighten this processing with that. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="dsc"> <xsl:apply-templates/> </xsl:template> <xsl:template match="*[starts-with(local-name(), 'c') and (@level = 'subseries' or @level = 'series')]"> <xsl:element name="{name()}"> <xsl:apply-templates> <xsl:with-param name="with-series">true</xsl:with-param> </xsl:apply-templates> </xsl:element> </xsl:template> <xsl:template match="*[starts-with(local-name(), 'c') and @level != 'subseries' and @level != 'series']"> <xsl:element name="{name()}"> <xsl:apply-templates> <xsl:with-param name="with-series" >false</xsl:with-param> </xsl:apply-templates> </xsl:element> </xsl:template> <xsl:template match="scopecontent"> <xsl:param name="with-series"/> <xsl:choose>
<xsl:when test="$with-series = 'true'">
<p><xsl:value-of select="."/></p>
</xsl:when>
<xsl:otherwise>
<p><font size="-1" color="gray"/><xsl:value-of select="."/> </p>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet>
|

Cart



