#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0

    XSL output issue


    Hi Guys,

    I have problems setting $devUrl value within table tag as seen in code below:

    Code:
    <!-- holds the Dev webserver URL  -->
      <xsl:variable name="devUrl" select="'dev.com'"/>
    
       <xsl:for-each select="$HostName">
        <xsl:if test="//Property[@Name='development']">
         <xsl:value-of select="$devUrl"/>
        </xsl:if>
       </xsl:for-each>
    
      <table cellspacing="0" cellpadding="0" border="0" style="display:inline;">
        <tr>
          <td width="1">
    	<img src="http://{$HostName}/images/dialog_btn_left.gif"/>
          </td>
          <td style="white-space:nowrap;" valign="middle" align="middle" background="http://{$HostName}/images/dialog_btn_mid.gif">
    	<a href="http://{$devUrl}/" target="_blank" class="button-link">Open Dev</a>
          </td>
          <td width="1">
    	<img src="http://{$HostName}/images/dialog_btn_right.gif"/>
          </td>
        </tr>
      </table>
    If I remove/comment for-each loop value shows. However I need the foreach loop to differentiate other servers in list that I will define later. I need to work within table tags for button. Any ideas on how to get this to work welcome.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0
    I resolved issue, answer below:

    Code:
    <!-- holds the Dev webserver URL  -->
      <xsl:variable name="devUrl" select="'dev.com'"/>
     
    <xsl:variable name="ServerHostName" select="/Server/Environment/Property[@Name='ServerHostName']"/>
    <xsl:choose>
     <xsl:when test="$ServerHostName[contains(.,'hostname')]"> 
      <table cellspacing="0" cellpadding="0" border="0" style="display:inline;">
        <tr>
          <td width="1">
    	<img src="http://{$ServerHostName}/images/dialog_btn_left.gif"/>
          </td>
          <td style="white-space:nowrap;" valign="middle" align="middle" background="http://{$ServerHostName}/images/dialog_btn_mid.gif">
    	<a href="http://{$devUrl}/" target="_blank" class="button-link">Open Dev</a>
          </td>
          <td width="1">
    	<img src="http://{$HostName}/images/dialog_btn_right.gif"/>
          </td>
        </tr>
      </table>
     </xsl:when>
    </xsl:choose>

IMN logo majestic logo threadwatch logo seochat tools logo