Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Pick/Choose XML from XSL

From: Morris M. Keesan <keesan@----.--.--->
To: NULL
Date: 12/2/2004 4:53:00 AM
On 1 Dec 2004 14:03:14 -0800, Prab_kar@h... (Prabh) wrote:
...
> Also, I want to ignore messages with 'debug' priority and
>print only the 'info' priority messages.
>
>
>Test.xml:
>==========================X M L==================================
...
>    <task>
>	<message priority="debug"><![CDATA[Info about Target Two: Ideally I
>shouldnt be displayed!!]]></message>
>    </task>
...
>  	<!-- show the messages -->
>  	<xsl:apply-templates select="task"/>
...
>I'm unable to ignore/discard the 'debug' messages.
> I'm trying to use '<xsl:template
>match="message[@priority] != 'debug'

You could use a few different approaches:

 <xsl:apply-templates select="task[message/@priority != 'debug']"/>
to apply templates only to those tasks with the right priority,
if <message> is the only possible child element of <task>, or

or

<xsl:template match="task">
  <xsl:if test="message/@priority != 'debug'">
    <xsl:value-of select="message"/>
  </xsl:if>
  <!-- ... other processing for contents of task ... -->
</xsl:template>

or even

<xsl:template match="message">
  <xsl:if test="@priority != 'debug'><xsl:value-of select="."/></xsl:if>
</xsl:template>

-- 
Morris M. Keesan -- keesan@a...



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent