xsl-list
[Top] [All Lists]

merging two templates with starts-with same name

2003-04-29 02:37:44
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



<Prev in Thread] Current Thread [Next in Thread>