|
Subject: Re: xsl:if to separate child elements From: "John E. Simpson" <simpson@xxxxxxxxxxx> Date: Tue, 26 Sep 2000 00:44:44 -0400 |
I am somehow really stuck trying to separate out different child elements using <xsl:if>. Please help with the following situation if possible:
Here is an example of the type of xml I am working with - 1 help element with multiple heltext and helpexample elements:
<category name="science"> <help> <helptext> This is a descriptive note </helptext> <helpexample> This is an example </helpexample> <helptext> This is another line of text </helptext> </help> </category>
I would like to do a for-each to be able to print out all helptext and helpexample elements in sequence, but I would like to give a different style to helptext vs helpexample (<pre></pre>).
<!-- Template for root <help> element -->
<xsl:template match="help">
<!-- Process all children of <help>, i.e. all
<helptext> and <helpexample> elems., in doc order -->
<xsl:apply-templates />
</xsl:template><!-- Template for <helptext> elements -->
<xsl:template match="helptext">
<!-- Wrap content in <pre> element -->
<pre><xsl:value-of select="." /></pre>
</xsl:template><!-- Template for <helpexample> element -->
<xsl:template match="helpexample">
<!-- Just output content -->
<xsl:value-of select="." />
</xsl:template><pre xmlns="http://www.w3.org/TR/REC-html40"> This is a descriptive note </pre> This is an example <pre xmlns="http://www.w3.org/TR/REC-html40"> This is another line of text </pre>
This is a descriptive note <--displays in fixed font This is an example <--displays in proportional font This is another line of text <--displays in fixed font
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| xsl:if to separate child elements, pmitra | Thread | RE: xsl:if to separate child elemen, Chris Bayes |
| xsl:if to separate child elements, pmitra | Date | RE: xsl:if to separate child elemen, Chris Bayes |
| Month |