开发者

table alignment using xslt

I created a table in a xslt file. Please check the screenshot. In the 2nd table of the screen, u can see that ID 2 does not appear on the same line. For some reason, 2 alone

table alignment using xslt

goes down. I want ID 2 to appear on the same line like ID 1.

I have also uploaded my xslt code here. Can someone kindly tell me a solution for this?

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet  version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">

    <html>
      <head>
        <title>VPGate Media Mixer</title>

        <meta http-equiv="expires" content="0"/>
        <meta http-equiv="pragma" content="no-cache"/>
        <meta http-equiv="cache-control" content="no-cache, must-revalidate"/>
        <meta http-equiv="refresh" content="15"></meta>
        <script src="/Common/common.js\" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="style001.css" />
        <link rel="stylesheet" type="text/css" href="Grid.Default.css" />


      </head>

      <body class="WorkArea">
        <div class="divSummaryHeader" id="SummaryHeader">
          <h1>Media Mixer - VPGate</h1>

          <xsl:for-each select="MMDiagnostics/Conference">
            <h1>
              Media Mixer - <xsl:value-of select="name"/>
            </h1>
          </xsl:for-each>
        </div>

        &#160;



        <div class="RadGrid RadGrid_Default" id="SummaryData" style="position:absolute;width:790px;overflow:auto">

          <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
            <tr>
              <input type="button" class="formEditBtn" id="SubBtn" value="Refresh" onclick="window.location=window.location;"/>

            </tr>开发者_如何学运维;
            <tr>
              <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference Summary</td>
            </tr>

            <tr>
              <td>
                <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0"  >
                  <tr>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference Name</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference ID</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Address</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Port</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Ssrc</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">No Of Participants</td>
                  </tr>

                  <xsl:for-each select="MediaMixer/Conference">
                    <!--<xsl:sort select="Name"/>-->
                    <xsl:if test="(position() mod 2 = 0)">

                      <tr class="rgAltRow SummaryTableDataRow">
                        <td valign = "top">
                          <xsl:value-of select="Name"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="ConfId"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="CompositeAddress"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="CompositePort"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="CompositeSsrc"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="NoOfParticipants"/>
                        </td>
                      </tr>
                    </xsl:if>

                    <xsl:if test="(position() mod 2 = 1)">
                      <td>
                        <tr class="rgRow SummaryTableDataRow">
                          <td valign = "top">
                            <xsl:value-of select="Name"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="ConfId"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="CompositeAddress"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="CompositePort"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="CompositeSsrc"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="NoOfParticipants"/>
                          </td>
                        </tr>
                      </td>
                    </xsl:if>

                  </xsl:for-each>

                </table>
              </td>
            </tr>
          </table>

          &#160;

          <table border="0" class="rgMasterTable rgClipCells" cellspacing="1" cellpadding="1"  >
            <tr>
              <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference Details</td>
            </tr>

            <tr>
              <td>

                <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
                  <tr>

                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 1</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 2</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Address</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Listening Port</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">MM Listening Port</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From Participant</td>
                    <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From MM</td>
                  </tr>

                  <xsl:for-each select="MediaMixer/Conference/Participant">

                    <xsl:if test="(position() mod 2 = 0)">

                      <tr class="rgAltRow SummaryTableDataRow">

                        <td valign = "top">
                          <xsl:value-of select="ID1"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="ID2"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="ParticipantAddress"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="ParticipantListeningPort"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="MMListeningPort"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="SSRCFromParticipant"/>
                        </td>
                        <td valign = "top">
                          <xsl:value-of select="SSRCFromMM"/>
                        </td>
                      </tr>
                    </xsl:if>

                    <xsl:if test="(position() mod 2 = 1)">
                      <td>
                        <tr class="rgRow SummaryTableDataRow">
                          <td valign = "top">
                            <xsl:value-of select="ID1"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="ID2"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="ParticipantAddress"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="ParticipantListeningPort"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="MMListeningPort"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="SSRCFromParticipant"/>
                          </td>
                          <td valign = "top">
                            <xsl:value-of select="SSRCFromMM"/>
                          </td>

                        </tr>
                      </td>
                    </xsl:if>
                  </xsl:for-each>

                </table>
              </td>
            </tr>
          </table>


          &#160;


          <div style="display:none">
            <iframe id="frameUpdate" name="frameUpdate" width="100%"></iframe>
          </div>


        </div>

      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


The correct way to avoid wrapping is by using the CSS style white-space

http://www.w3.org/TR/CSS2/text.html#propdef-white-space

E.g.

<td style="white-space: nowrap">ID 2</td>

Of course, you can also move the white-space style into a CSS class. I guess you'll have to play around a little bit, to get it right for your table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜