[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: template problem...ignoring first match

Subject: Re: template problem...ignoring first match
From: "John Liebermann" <ahsan_hussain@xxxxxxxxxxxxx>
Date: Wed, 30 Jul 2003 13:30:02 -0700
xsl first match
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.