Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2008, 10:45 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi, this is the complete file & code - hope this helps - Regards



<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asp="remove" xmlns:igchart="remove" xmlns:igsch="remove">
<xsl:output omit-xml-declaration = "yes" />
<xsl:template match="/">
<table width="100%" class="tbDetail">

    <tr>
        <td>
            <SCRIPT TYPE='text/javascript'>
                function hideHist()
                {
                    if (typeof fcHist != 'undefined')
                    {
                        fcHist.style.display = 'none';
                    }
                }
            </SCRIPT>
      <link rel="stylesheet" type="text/css" href="balloontip.css" />

      <script type="text/javascript" src="balloontip.js">
      </script>


      <!-- <style type="text/css" media="all">
        @import "css/global.css";
      </style>
      <script src="js/jquery.js" type="text/javascript"></script>
      <script src="js/jtip.js" type="text/javascript"></script> -->

      <script TYPE='text/javascript' src="./codebase/dhtmlxcommon.js"></script>
      <script TYPE='text/javascript' src="./codebase/dhtmlxcombo.js"></script>
      <link rel="STYLESHEET" type="text/css" href="./codebase/dhtmlxcombo.css"></link>

      <script TYPE='text/javascript'>
          window.dhx_globalImgPath="./codebase/imgs/";
      </script>
        </td>
    </tr>
    <xsl:variable name="cHist" select="count(Activity/myTracking/Activity[ DateResolved != '0' ])" />
    <xsl:if test="$cHist &gt; '0'">
        <tr width="100%">
            <td colspan="6" class="row1">
                <SCRIPT TYPE='text/javascript'>
                    function toggleHist(srcElement, srcArrow) {
                        if (srcElement.style.display == 'none')
                        {
                            srcElement.style.display = '';
                            srcArrow.src = 'images/expand.gif';
                        } else
                        {
                            srcElement.style.display = 'none';
                            srcArrow.src = 'images/collapse.gif';
                        }
                    }
                </SCRIPT>
                <span id='fcHistMain' style='cursor:hand;' onclick='toggleHist(fcHist, fcExpand)'>
                    <span style="vertical-align:middle;">
                        <img src='images/collapse.gif' id='fcExpand' align="middle" />#160;Expand to view the History
                    </span>
                </span>
            </td>
        </tr>
        <tr>
            <td colspan="6">
                <div id='fcHist'>
                    <table width='100%' class='tbList'>
                    <xsl:for-each select="Activity/myTracking/Activity[ DateResolved != '0' ]">
                        <xsl:sort select='@id' />
                        <tr>
                            <td width='5%'><xsl:attribute name='class'><xsl:if test="position() mod 2 = 1">on</xsl:if><xsl:if test="position() mod 2 != 1">off</xsl:if></xsl:attribute><xsl:value-of select="position()" />.#160;</td>
                            <td width='55%'><xsl:attribute name='class'><xsl:if test="position() mod 2 = 1">on</xsl:if><xsl:if test="position() mod 2 != 1">off</xsl:if></xsl:attribute>
                                <xsl:if test="TrackValues = 'False'">
                                    <xsl:value-of select="Description" />
                                </xsl:if>
                                <xsl:if test="TrackValues = 'True' or TrackValues = ''">
                                    <a>
                                        <xsl:attribute name='href'>myTrackingPage.aspx?type=a&amp;id=<xsl :value-of select="@id" /></xsl:attribute>
                                        <xsl:attribute name='class'>bn</xsl:attribute>
                                        <xsl:value-of select="Description" />
                                    </a>
                                </xsl:if>
                            </td>
                            <td width='20%'><xsl:attribute name='class'><xsl:if test="position() mod 2 = 1">on</xsl:if><xsl:if test="position() mod 2 != 1">off</xsl:if></xsl:attribute>
                                <xsl:if test="CreatorEMail[. = '']"><xsl:value-of select="Creator" /></xsl:if>
                                <xsl:if test="CreatorEMail[. != '']">
                                <a>
                                    <xsl:attribute name='class'>bn</xsl:attribute>
                                    <xsl:attribute name='href'>mailto:<xsl:value-of select="CreatorEMail" />?Subject=<xsl:value-of select="Description" /></xsl:attribute>
                                    <xsl:value-of select="Creator" />
                                </a>
                                </xsl:if>
                            </td>
                            <td width='20%'>
                                <xsl:attribute name='class'><xsl:if test="position() mod 2 = 1">on</xsl:if><xsl:if test="position() mod 2 != 1">off</xsl:if></xsl:attribute>
                                <xsl:value-of select="substring(DateResolved,1,4)"/>/<xsl:value-of select="substring(DateResolved,5,2)"/>/<xsl:value-of select="substring(DateResolved,7,2)" />#160;
                                <xsl:value-of select="substring(TimeResolved,1,2)" />:<xsl:value-of select="substring(TimeResolved,3,2)" />:<xsl:value-of select="substring(TimeResolved,5,2)" />
                            </td>
                        </tr>
                    </xsl:for-each>
                    </table>
                </div>
            </td>
        </tr>
    </xsl:if>


    <xsl:for-each select="Activity/ObjectGroup[@type='default']/Object">
    <xsl:sort select="@index" data-type="number" />
    <xsl:variable name="index" select="@index" />
    <xsl:variable name="nextNode" select="../Object[ @index > $index ][1]" />
    <xsl:variable name="nextCol" select="$nextNode/@columnNo" />
    <xsl:variable name="vis" select="string(Attributes/Attribute[ @name='visible'])" />
    <xsl:variable name="visNextCol" select="string($nextNode/Attributes/Attribute[ @name='visible'])" />
    <xsl:if test="($vis != 'False') or ($nextCol = '2' and ($vis != 'False' or $visNextCol != 'False'))">
    <xsl:if test="(@columnNo != '2')">
    <tr class="rowDetail">


        <xsl:choose>
        <xsl:when test="(string(Attributes/Attribute[ @name='visible']) = '') or (Attributes/Attribute[ @name='visible'] != 'False')">

            <td width='15%' align='left' class='rowDet'>
                <xsl:value-of select="Description" disable-output-escaping="yes" />#160;
                <xsl:if test="Mask[. != '']">(<xsl:value-of select="Mask" />)#160;</xsl:if>

        <xsl:if test=" @required[. = 'true']"></xsl:if>#160;
            </td>
            <td valign="middle">
                <xsl:if test="($nextCol != '2') or (count(following-sibling::*) = 0) or ($nextCol = '2' and $visNextCol = 'False')">
                    <xsl:attribute name='colspan'>4</xsl:attribute>
                    <xsl:attribute name='width'>70%</xsl:attribute>
                </xsl:if>
                <xsl:call-template name="CreateObject">
                    <xsl:with-param name="Object" select="." />
                </xsl:call-template>
                <xsl:if test="Tooltip != ''">
                #160;
          <xsl:element name="asp:image"> <img src="images/tooltip.gif"></img>
                    <xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
                    <xsl:attribute name='runat'>server</xsl:attribute>
                    <xsl:attribute name='imageurl'>images/tooltip.gif</xsl:attribute>

          <!--<a>

            <xsl:attribute name='href'>ajax.htm?width=375</xsl:attribute>
            <xsl:attribute name='id'>one</xsl:attribute>
            <xsl:attribute name='style'>border : none;</xsl:attribute>
            <xsl:attribute name='class'>jTip</xsl:attribute>
            <xsl:attribute name='name'><xsl:value-of select="Tooltip" /></xsl:attribute>
            <xsl:attribute name='imageurl'>images/tooltip.gif</xsl:attribute>
            <img src="images/tooltip.gif" style="border : none;"></img>
           ??
          </a>-->
          <a>
            <xsl:attribute name='href'>ajax.htm</xsl:attribute>
            <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
            <!-- <xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
            <xsl:attribute name='class'>balloonstyle</xsl:attribute>-->
          <!-- <xsl:attribute name='id'>one</xsl:attribute>
            <xsl:attribute name='style'>border : none;</xsl:attribute>
            <xsl:attribute name='class'>jTip</xsl:attribute>
            <xsl:attribute name='name'>
              <xsl:value-of select="Tooltip" />
            </xsl:attribute>-->
            <!--<xsl:attribute name='imageurl'>images/tooltip.gif</xsl:attribute>
            <img src="images/tooltip.gif" style="border : none;"></img>-->
            ??
          </a>
           <div id="ttip_<xsl:value-of select='@name' /> class="balloonstyle">
            <xsl:value-of select="Tooltip" />
          </div>
                </xsl:element>
                </xsl:if>
            </td>
            <td width='5%' align="right">
      <!--
            <xsl:if test="@dynamic='true'">
                <xsl:element name="asp:imageButton">
                    <xsl:attribute name='id'>reload_<xsl:value-of select='@name' /></xsl:attribute>
                    <xsl:attribute name='runat'>server</xsl:attribute>
                    <xsl:attribute name='imageurl'>images/reload.gif</xsl:attribute>
                    <xsl:attribute name='alt'>Reload <xsl:value-of select="Description" /></xsl:attribute>
                </xsl:element>
            </xsl:if>
      -->
            </td>

        </xsl:when>
        <xsl:otherwise>
            <td width='15%' align='right' class='rowDet'>#160;</td>
            <td valign="middle">#160;</td>
            <td width='5%' align="right">#160;</td>
        </xsl:otherwise>
        </xsl:choose>

        <xsl:if test="($nextCol = '2') and $visNextCol != 'False'">

            <td width='15%' align='left' class='rowDet'>
                <xsl:value-of select="$nextNode/Description" disable-output-escaping="yes" />#160;
                <xsl:if test="$nextNode/Mask[. != '']">(<xsl:value-of select="$nextNode/Mask" />)#160;</xsl:if>

        <xsl:if test=" @required[. = 'true']"></xsl:if>#160;
            </td>
            <td width='30%' valign="middle">
                <xsl:call-template name="CreateObject">
                    <xsl:with-param name="Object" select="$nextNode" />
                </xsl:call-template>
                <xsl:if test="$nextNode/Tooltip != ''">
                #160;
                <xsl:element name="asp:image">
                    <xsl:attribute name='id'>ttip_<xsl:value-of select='$nextNode/@name' /></xsl:attribute>
                    <xsl:attribute name='runat'>server</xsl:attribute>
                    <xsl:attribute name='imageurl'>images/tooltip.gif</xsl:attribute>
                    <xsl:attribute name='alt'><xsl:value-of select="$nextNode/Tooltip" /></xsl:attribute>
                </xsl:element>
                </xsl:if>
            </td>
            <td width='5%' align="right">
            <!--
       <xsl:if test="$nextNode/@dynamic='true'">
                <xsl:element name="asp:imageButton">
                    <xsl:attribute name='id'>reload_<xsl:value-of select='$nextNode/@name' /></xsl:attribute>
                    <xsl:attribute name='runat'>server</xsl:attribute>
                    <xsl:attribute name='imageurl'>images/reload.gif</xsl:attribute>
                    <xsl:attribute name='alt'>Reload <xsl:value-of select="$nextNode/Description" /></xsl:attribute>
                </xsl:element>
            </xsl:if>
      -->
            </td>
        </xsl:if>
    </tr>
    </xsl:if>
    </xsl:if>
    </xsl:for-each>


    <xsl:for-each select="Activity/ObjectGroup[@type='group'][ @visible='true' ]">
    <xsl:sort select="@name" />
    <xsl:variable name="tmpGroup" select="@id" />
    <tr>
        <td colspan='6' width='100%'>
            <table width='100%' cellpadding='0' cellspacing='0' style='border: 1 solid #000000'>
                <tr>
                    <td width='80%' class='rowDet'><b><xsl:value-of select="Description" /></b></td>
                    <td class='rowDet' align='right'>
                        <xsl:if test="count(Object[ @dynamic='true' ]) &gt; 0">
                            <xsl:element name="asp:imageButton">
                                <xsl:attribute name='id'>reloadGroup_<xsl:value-of select='@id' /></xsl:attribute>
                                <xsl:attribute name='runat'>server</xsl:attribute>
                                <xsl:attribute name='imageurl'>images/reloadGroup.gif</xsl:attribute>
                                <xsl:attribute name='alt'>Reload <xsl:value-of select="Description" /></xsl:attribute>
                            </xsl:element>
                        </xsl:if>#160;
                        <xsl:if test="@allowadd[ .='true']">
                            <xsl:element name="asp:imageButton">
                                <xsl:attribute name='id'>lia_<xsl:value-of select='@id' /></xsl:attribute>
                                <xsl:attribute name='runat'>server</xsl:attribute>
                                <xsl:attribute name='src'>images/add.gif</xsl:attribute>
                                <xsl:attribute name='alt'>Add <xsl:value-of select="Description" /></xsl:attribute>
                            </xsl:element>
                        </xsl:if>#160;
                        <xsl:if test="@allowdelete[ .='true']">
                            <xsl:element name="asp:imageButton">
                                <xsl:attribute name='id'>lid_<xsl:value-of select='@id' /></xsl:attribute>
                                <xsl:attribute name='runat'>server</xsl:attribute>
                                <xsl:attribute name='src'>images/delete.gif</xsl:attribute>
                                <xsl:attribute name='alt'>Delete <xsl:value-of select="Description" /></xsl:attribute>
                            </xsl:element>
                        </xsl:if>
                    </td>
                </tr>

                <tr>
                    <td colspan='2' width='100%'>
                        <table cellspacing='1' cellpadding='3'>
                            <tr>
                                <xsl:if test="@count &gt; 0">

                                    <td></td>
                                    <xsl:for-each select="Object">
                                    <xsl:sort select="@index" data-type="number" />
                                        <xsl:if test="(string(Attributes/Attribute[ @name='visible']) = '') or (Attributes/Attribute[ @name='visible'] != 'False')">
                                            <td class='rowdet'>
                                                <xsl:attribute name='align'>center</xsl:attribute>
                                                <b><xsl:value-of select="Description" disable-output-escaping="yes" /></b>
                                            </td>
                                        </xsl:if>
                                    </xsl:for-each>
                                    <td></td>
                                </xsl:if>
                                <xsl:if test="@count = 0">
                                    <td>( No items found )</td>
                                </xsl:if>
                            </tr>

                            <xsl:if test="@count &gt; 0">

                                <xsl:variable name="obj" select="Object[ position()=1 ]/@name" />
                                <xsl:for-each select="Object[ @name=$obj ]/Value/@instance">
                                    <xsl:variable name="line" select="." />
                                    <tr>

                                        <xsl:choose>
                                                <xsl:when test="//ObjectGroup[@id=$tmpGroup][@allowadd='true']">
                                                    <td>
                                                        <xsl:element name="asp:CheckBox">
                                                            <xsl:attribute name='id'>__linecheck_<xsl:value-of select='$tmpGroup' />_<xsl:value-of select='$line' /></xsl:attribute>
                                                            <xsl:attribute name='runat'>server</xsl:attribute>
                                                        </xsl:element>
                                                    </td>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <td></td>
                                                </xsl:otherwise>
                                        </xsl:choose>


                                        <xsl:for-each select="//ObjectGroup[@id=$tmpGroup]/Object">
                                        <xsl:sort select="@index" data-type="number" />
                                        <xsl:variable name="name" select="concat('li_',concat($tmpGroup,concat('_',c oncat($line,concat('_',@name)))))" />
                                        <xsl:choose>
                                        <xsl:when test="(string(Attributes/Attribute[ @name='visible']) = '') or (Attributes/Attribute[ @name='visible'] != 'False')">
                                        <td>
                                            <xsl:call-template name="CreateLineItemObject">
                                                <xsl:with-param name="Object" select="." />
                                                <xsl:with-param name="name" select="$name" />
                                                <xsl:with-param name="line" select="$line" />
                                                <xsl:with-param name="tmpGroup" select="$tmpGroup" />
                                            </xsl:call-template>
                                        </td>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:call-template name="ReferenceLabel">
                                                <xsl:with-param name="Name" select="$name" />
                                                <xsl:with-param name="Attributes" select="Attributes" />
                                                <xsl:with-param name="Value" select="Value[ @instance=$line ]" />
                                            </xsl:call-template>
                                        </xsl:otherwise>
                                        </xsl:choose>
                                        </xsl:for-each>
                                    </tr>
                                </xsl:for-each>
                            </xsl:if>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </xsl:for-each>

    <!--
        Now dump in the ungrouped invisible objects, if any.
        Invisible objects will always be output as labels, cause we're
        simply after an Object Name / Object Value pairing.
    -->
    <tr>
        <td colspan="6">
            <xsl:for-each select="Activity/ObjectGroup[@type='default']/Object[ ./Attributes/Attribute[ @name='visible' ] = 'False' ]">
                <xsl:call-template name="ReferenceLabel">
                    <xsl:with-param name="Name" select="@name" />
                    <xsl:with-param name="Attributes" select="Attributes" />
                    <xsl:with-param name="Value" select="Value" />
                </xsl:call-template>
 
Old January 15th, 2008, 03:45 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi, i think i understand the example:
The problem is that I can't assisgn an xsl value to Div ID

[u]This is the HTML example: </u>
<a href="http://www.dynamicdrive.com/style/" rel="balloon1">??</a>
<div id="balloon1" class="balloonstyle">Test</div>

The rel="balloon1" is equal to the div id="balloon1"

I get the Rel in the xslt going but can't connect with the DIV ID as it moans about the code in bold!

<a>
<xsl:attribute name='href'>ajax.htm</xsl:attribute>
<xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>??
</a>

<div id="ttip_<xsl:value-of select='@name'/>" class="balloonstyle">
<xsl:value-of select="Tooltip" />
</div>

Please Assist!

 
Old January 16th, 2008, 05:22 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thank You very much - Great stuff !!!

Thank You Joe & All for all the help, assistance & patience!
I started feeling bad posting everytime as I was being a nuisance and a pain.

My search to fix the tooltip has come to an end:

As you came across i have no experience in xslt - just recently started looking into making changes to the file. As I'm coding in Flowcentric which uses xslt as stylesheet & users wanted changes to the app. So i started playing with the xslt file.

This did solve my problem to fix the tooltip!

<a href="ajax.htm" rel="ttip_{@name}"></a>

<div id="ttip_{@name}" class="balloonstyle">
<xsl:value-of select="Tooltip" />
</div>


Thank You for your kindness & patience!!!
Regards







Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorporate HTML Code in XSLT (Drop down border) ismailc XSLT 3 January 14th, 2008 09:18 AM
incorporate javascript, works in html but not xslt ismailc XSLT 2 December 12th, 2007 03:32 AM
How can I take HTML content in XSLT? nadavvin XSLT 7 September 6th, 2006 09:18 AM
XSLT of an HTML data NEO1976 XSLT 3 July 5th, 2006 08:28 AM
HTML for XSLT tarunm XSLT 1 November 14th, 2005 11:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.