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

RE: merging two templates with starts-with same name

Subject: RE: merging two templates with starts-with same name
From: "Bryan Archer" <barcher@xxxxxx>
Date: Tue, 29 Apr 2003 11:28:12 +0100
template match starts with
I can not say I understand exactly what you are trying to achieve, 
perhaps you can supply an example of your xml and how you 
are calling each of the templates.

However, your consolidated template might look like:

<xsl:template match="*[substring(name(),1,5)='refDB']" mode="refDB">
  <xsl:param name="refDB"/>
  <xsl:choose>
    <xsl:when test="normalize-space($refDB) != '' "><xsl:value-of select="$refDB"/></xsl:when>
    <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  </xsl:choose>
</xsl:template>

Regards
Bryan

-----Original Message-----
From: "Braumüller, Hans" [mailto:H.Braumueller@xxxxxxxxxxxx]
Sent: 29 April 2003 10:38
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  merging two templates with starts-with same name 


Hello friends,

small problem but i cannot get the solution

i have two similar templates:

<xsl:template match="refDB1" mode="refDB">
  <xsl:param name="refDB"/>
  <xsl:choose>
	<xsl:when test="normalize-space($refDB) != '' "><xsl:value-of select="$refDB"/></xsl:when>
	<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
    </xsl:choose>
 </xsl:template>
 
  <xsl:template match="refDB2" mode="refDB">
  <xsl:param name="refDB" />
  <xsl:choose>
	<xsl:when test="normalize-space($refDB) != '' "><xsl:value-of select="$refDB"/></xsl:when>
	<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
   </xsl:choose>
 </xsl:template> 

i am trying to do one for all nodes that starts-with refDB like pseudo-code:

<xsl:template match="*[name() = starts-with(refDB, *)]" mode="refDB">
    <xsl:param name="refDB" />
  <xsl:choose>
<xsl:when test="normalize-space($refDB) != '' "><xsl:value-of select="$refDB"/></xsl:when>
		<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
   </xsl:choose>
 </xsl:template>

As second optimization i am trying to figure out how i can select a variable instead a to pass a parameter with the selecting node, because i am matching node refDB1 on my properties.xml (over document() ) so i know that name to select it igual on my source.xml, where if it is empty or not exists, i output the value of my properties.xml.


Thanks,

 
Hans Braumüller 
-- + -- 
Mail Art Not War
http://crosses.net

 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Visit our website at http://www.rm.com

This message is confidential.  You should not copy it
or disclose its contents to anyone.  You may use and apply the information
only for the intended purpose.  Internet communications are not secure and
therefore RM does not accept legal responsibility for the contents of this
message.  Any views or opinions presented are only those of the author and
not those of RM.  If this email has come to you in error please delete it
and any attachments.  Please note that RM may intercept incoming and
outgoing e-mail communications.

This email has been scanned for viruses by Trend ScanMail.

 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.