|
Subject: Re: [xsl] Printing all child bachelor nodes From: Jon Gorman <jonathan.gorman@xxxxxxxxx> Date: Thu, 9 Feb 2006 09:59:53 -0600 |
On 2/9/06, Douglas F Shearer <dougal.s@xxxxxxxxx> wrote:
> I have one more query, is there anyway I could have ONLY the beds in
> bold?
>
If you need to start treating some children in different fashions I'd
recommend a mode approach...something like
<xsl:template match="features">
<xsl:apply-templates mode="pretty-print" />
</xsl:template
<xsl:template match="*" mode="pretty-print">
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', name(), ':', .)"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
<xsl:text>.</xsl:text>
</xsl:template>
<xsl:template match="bed" mode="pretty-print">
<b>
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', name(), ':', .)"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
<xsl:text>.</xsl:text>
</b>
</xsl:template>
You could further refactor that and have a call-template and yank out
that common code...ie
<xsl:template match="*" mode="pretty-print">
<xsl:call-template name="printAtt">
<xsl:with-param name="node" select="." />
</xsl:template>
<xls:template name="printAtt">
<xsl:param name='node' />
<xsl:for-each select="node/@*">
<xsl:value-of select="concat(' ', name(), ':', .)"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
<xsl:text>.</xsl:text>
</xsl:template>
and so on. (And hopefully replace that <b> with a span or something
with class info).
Jon Gorman
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Printing all child bachel, andrew welch | Thread | RE: [xsl] Printing all child bachel, cknell |
| Re: [xsl] Printing all child bachel, andrew welch | Date | [xsl] help with select, Jiang, Peiyun |
| Month |