Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Question on flow

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/2/2008 6:16:00 PM

tshad wrote:

> If it decides which one to choose, why if you have the pattern:
> 
> <xsl:template match="FIELDS/*[starts-with(name(), 'SCMCOMMENTS')]">
> 
> does it know to use this one:
> 
>      <xsl:apply-templates select="FORMS/FORM/FIELDS/*[starts-with(name(),
> 'SCMCOMMENTS')]"/>
> 
> They aren't the same - but they are similar.  Why did you leave FORMS/FORM/ 
> off of the template but not the apply-template?

Well with the apply-templates you need to select the nodes you want to 
be processed and inside the 'REPORT' element template you want to 
process FORMS/FORM/FIELDS/*[starts-with(name(),'SCMCOMMENTS')].
If you did just
   <xsl:apply-templates select="FIELDS/*[starts-with(name(), 
'SCMCOMMENTS')]"/>
then that would not work as the 'REPORT' elements has no 'FIELDS' 
element children at all.

The pattern given in match attribute of xsl:template can be shorter, you 
just need to make sure your patterns precisely match what you want to 
process and in that case it suffices to give the parent 
match="FIELDS/*[starts-with(name(), 'SCMCOMMENTS')]".
If you want you can author that as
   <xsl:template match="FORMS/FORM/FIELDS/*[starts-with(name(),
'SCMCOMMENTS')]">
but for your input document it is not necessary and not different in the 
result.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
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