xsl-list
[Top] [All Lists]

Re: template problem...ignoring first match

2003-07-30 13:30:02
Thanks Zinc for your help. That works.

As you can see from my XSL, i am using <HSString>, <HSInteger> etc.
templates with mode="target" to put descriptions below the tree. I don't
have descriptions for <HSDataContainerType>. I want to ignore the outermost
<HSDataContainerType> because it is the 'Inputs' or the 'Outputs' but beyond
that i would like to put descriptions for all Data Containers. I thought i
could use the same code that as i did for <HSString> etc. but when i use
this code, it doesn't seem to work.

I use:
<xsl:template match="HSContract/HSDataContainerType//HSDataContainerType"
mode="target">

to ignore the first match on HSDataContainerType and to include all matched
beyond the first one since Data Containers could be anywhere in the
hierarchy. Is this correct?

Also, i feel the problem could be that is not processing any <HSString> etc
elements inside of a Data Container since it only has descriptions for the
ones below it but nothing for the ones inside of it.

Any help would be greatly appreciated.

Regards,

John Liebermann


Snippet to put Descriptions for HSDataContainerType:

  <xsl:template match="HSContract/HSDataContainerType//HSDataContainerType"
mode="target">
        <img src="texticon.gif">
                        <a name="{generate-id(.)}">
                                <b>
                                        <xsl:comment>Accessing the parent 
nodes...</xsl:comment>
                                        <xsl:for-each select="ancestor::*">
                                                <xsl:choose>
                                                        <xsl:when 
test="contains(@name, 'Inputs')"></xsl:when>
                                                        <xsl:when 
test="contains(@name, 'Outputs')"></xsl:when>
                                                        <xsl:when 
test="contains(@name, 'Settings')"></xsl:when>
                                                        <xsl:otherwise>
                                                                <xsl:if 
test="not(position()='1')">
                                                                        
<xsl:value-of select="@name" />/
                                                                </xsl:if>
                                                        </xsl:otherwise>
                                                </xsl:choose>
                                        </xsl:for-each>
                                        <xsl:value-of select="@name" />
                                </b>
                        </a>
                </img>
                <br />
                <!-- Handle HSDocumentation inside a dataContainer in here -->
                <xsl:text>Description: </xsl:text>
                <xsl:choose>
                        <xsl:when test="normalize-space(HSDocumentation) = ''">
                                None
                                <br />
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:value-of select="HSDocumentation" />
                                <br />
                        </xsl:otherwise>
                </xsl:choose>
                <xsl:text>Required: </xsl:text>
                <xsl:choose>
                        <xsl:when test="contains(@required, 'true')">
                                Yes
                                <br />
                        </xsl:when>
                        <!-- if optional, then default value exists or doesn't 
exist-->
                        <xsl:otherwise>No
                                <br />
                                Default Value:
                                <!--if default tag has some value, display 
otherwise say "No Default
Value"-->
                                <xsl:choose>
                                        <xsl:when 
test="normalize-space(DefaultValue) = ''">
                                                None
                                                <br />
                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:value-of 
select="DefaultValue" />
                                                <br />
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:otherwise>
                </xsl:choose>

        </xsl:template>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • Re: template problem...ignoring first match, John Liebermann <=