Subject: Re: [xsl] Simplify HAIRY xslt From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 14 May 2004 13:15:35 -0400 |
<xsl:template name="rule"> <xsl:param name="uri"/> <xsl:variable name="prefix" select="../@prefix"/>
<res:choose>
<res:when test="*[name() = '{$prefix}:rule']">
<xsl:element name="{$prefix}:rule" namespace="{$uri}">
<xsl:if test="string(@display)">
<xsl:attribute name="displayValue">{<xsl:value-of select="@display"/>}</xsl:attribute>
</xsl:if>
<xsl:attribute name="uid">{*[name() = '<xsl:value-of select="$prefix"/>:rule']/@uid}</xsl:attribute>
<xsl:attribute name="xpath">{$newXpath}</xsl:attribute>
<xsl:attribute name="type">{$type}</xsl:attribute>
<xsl:copy-of select="@*|node()"/>
</xsl:element>
</res:when>
<res:otherwise>
<xsl:element name="{$prefix}:rule" namespace="{$uri}">
<xsl:if test="string(@display)">
<xsl:attribute name="displayValue">{<xsl:value-of select="@display"/>}</xsl:attribute>
</xsl:if>
<xsl:attribute name="uid">{generate-id()}_<xsl:value-of select="$prefix"/></xsl:attribute>
<xsl:attribute name="xpath">{$newXpath}</xsl:attribute>
<xsl:attribute name="type">{$type}</xsl:attribute>
<xsl:copy-of select="@*|node()"/>
</xsl:element>
</res:otherwise>
</res:choose>
</xsl:template>
<xsl:template name="rule"> <xsl:param name="uri"/> <xsl:variable name="prefix" select="../@prefix"/>
<res:choose> <res:when test="*[name() = '{$prefix}:rule']"> <xsl:text>{*[name() = '</xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>:rule']/@uid}</xsl:text> </res:when> <res:otherwise> <xsl:text>{generate-id()}_</xsl:text> <xsl:value-of select="$prefix"/> </res:otherwise> </res:choose>
</xsl:attribute> <xsl:attribute name="xpath">{$newXpath}</xsl:attribute> <xsl:attribute name="type">{$type}</xsl:attribute> <xsl:copy-of select="@*|node()"/> </xsl:element> </xsl:template>
<xsl:template name="rule"> <xsl:param name="uri"/> <xsl:variable name="prefix" select="../@prefix"/> <xsl:variable name="uid-assign">
<res:choose> <res:when test="*[name() = '{$prefix}:rule']"> <xsl:text>{*[name() = '</xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>:rule']/@uid}</xsl:text> </res:when> <res:otherwise> <xsl:text>{generate-id()}_</xsl:text> <xsl:value-of select="$prefix"/> </res:otherwise> </res:choose>
which can be handy for parameterization, shortening the syntax, etc. (You will want to straighten up the indents in that code.)
I hope that helps. Wendell
Sorry about the long lines.
Thanks
/Marcus
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Simplify HAIRY xslt, Marcus Andersson | Thread | Re: [xsl] Simplify HAIRY xslt, J.Pietschmann |
RE: [xsl] killing xslt, Pieter Reint Siegers | Date | Re: [xsl] Simplify HAIRY xslt, J.Pietschmann |
Month |