Jump to content

Ignoring <xsl:template Match> ?


TriumphantOgre

Recommended Posts

I'm trying to optimise the XSL we use, and have a little issue...Currently, using our XSL, we have

<xsl:template match="/">

Thing is, for every single instance of a value being pulled through or checked, we use something along the lines of

<xsl:when test="Response/MessageBody/CFAssessments/CFAssessmentsRow/...>

and

<xsl:value-of select="Response/MessageBody/CFAssessments/CFAssessmentsRow/...>

Obviously, this is a lot of extra code, especially when it's happening over a hundred times in one form. So, I'm experimenting with

<xsl:template match="/Response/MessageBody/CFAssessments/CFAssessmentsRow">

It works, but for one thing. At the start of our XML files, before the CFASSessments, we have

<MessageHeader>  <MessageVersion>1.0</MessageVersion>  <MessageType>ASSESSMENTS</MessageType>  <MessageId>123</MessageId>  <SourceApplication>X</SourceApplication></MessageHeader>

The XSL is outputting 1.0 ASSESSMENTS 123 X at the very top of the page.How do I get it to ignore the contents of the MessageHeader?

Link to comment
Share on other sites

You seem to want to rely on the built-in templates to recursively process nodes level by level until your 'CFAssessmentRow' elements are matched. In that case, if you don't want the MessageHeader element to output anything then add a template ensuring that e.g.

<xsl:template match="MessageHeader"/>

As an alternative, don't rely on built-in templates but rather ensure that only those elements are processed you are interested in by doing e.g.

<xsl:template mach="/">  <xsl:apply-templates select="Response/MessageBody/CFAssessments/CFAssessmentsRow"/></xsl:template>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...