|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Printing all child bachelor nodes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








