Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

xsl za prikaz tabele u sharepoint-u

[es] :: XML :: xsl za prikaz tabele u sharepoint-u

[ Pregleda: 1691 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

gogi100
Goran Ljubic

Član broj: 40722
Poruke: 1064
*.static.isp.telekom.rs.



+3 Profil

icon xsl za prikaz tabele u sharepoint-u31.03.2017. u 11:59 - pre 85 meseci
imam dataview web part koji vuce podatke iz dve liste u sharepointu. pokusavam da promenim njegov prikaz ali mi ne ide jer ne poznajem dovoljno xsl. kod je sledeci

Code:
<XSL>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:agg="http://schemas.microsoft.com/sharepoint/aggregatesource" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
    <xsl:output method="html" indent="no"/>
    <xsl:decimal-format NaN=""/>
    <xsl:param name="dvt_apos">'</xsl:param>
    <xsl:param name="ManualRefresh"></xsl:param>
    <xsl:param name="dvt_firstrow">1</xsl:param>
    <xsl:param name="dvt_nextpagedata" />
    <xsl:param name="dvt_groupfield" />
    <xsl:variable name="dvt_1_automode">0</xsl:variable>
    
    
    
    <xsl:template match="/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:agg="http://schemas.microsoft.com/sharepoint/aggregatesource" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
        <xsl:choose>
            <xsl:when test="($ManualRefresh = 'True')">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="top">
                            <xsl:call-template name="dvt_1"/>
                        </td>
                        <td width="1%" class="ms-vb" valign="top">
                            <img src="/_layouts/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>
                        </td>
                    </tr>
                </table>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="dvt_1"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template name="dvt_1">
        <xsl:variable name="dvt_StyleName">Table</xsl:variable>
        <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@_x041f__x043e__x0442__x0432__x04 = 'Da']"/>
        <xsl:variable name="dvt_RowCount" select="count($Rows)"/>
        <xsl:variable name="RowLimit" select="10" />
        <xsl:variable name="FirstRow" select="$dvt_firstrow" />
        <xsl:variable name="LastRow">
            <xsl:choose>
                <xsl:when test="($FirstRow + $RowLimit - 1) &gt; $dvt_RowCount"><xsl:value-of select="$dvt_RowCount" /></xsl:when>
                <xsl:otherwise><xsl:value-of select="$FirstRow + $RowLimit - 1" /></xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
        <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>
        
        <xsl:choose>
            <xsl:when test="$dvt_IsEmpty">
                <xsl:call-template name="dvt_1.empty"/>
            </xsl:when>
            <xsl:otherwise>
                <table border="0" width="100%" cellpadding="0" cellspacing="0">
                    <tr >
                        <th   style="width: 261px; text-align:center">Sredstvo koje se izdaje</th>
                        <th   style="width: 164px; text-align:center">Izdata sredstva - trenutno stanje</th>
                        <th   style="width: 240px; text-align:center">Količina - početno stanje</th>
                        </tr>
                    <xsl:call-template name="dvt_1.body">
                        <xsl:with-param name="Rows" select="$Rows"/>
                        <xsl:with-param name="FirstRow" select="$FirstRow" />
                        <xsl:with-param name="LastRow" select="$LastRow" />
                    </xsl:call-template>
                </table>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:call-template name="dvt_1.commandfooter">
            <xsl:with-param name="FirstRow" select="$FirstRow" />
            <xsl:with-param name="LastRow" select="$LastRow" />
            <xsl:with-param name="RowLimit" select="$RowLimit" />
            <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
            <xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="dvt_1.body">
        <xsl:param name="Rows"/>
        <xsl:param name="FirstRow" />
        <xsl:param name="LastRow" />
        <xsl:variable name="dvt_Rows"><root>
            <xsl:for-each select="$Rows">
                <xsl:sort select="@_x0418__x0437__x0434__x0430__x04" order="ascending" />
                <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow)"><xsl:copy-of select="." /></xsl:if>
            </xsl:for-each>
            </root></xsl:variable>
        <xsl:for-each select="$Rows">
            <xsl:sort select="@_x0418__x0437__x0434__x0430__x04" order="ascending" />
            <xsl:variable name="NewGroup_0">
                <xsl:choose>
                    <xsl:when test="not ($dvt_groupfield)"><xsl:value-of select="ddwrt:NameChanged(string(@_x0418__x0437__x0434__x0430__x04), 0)" /></xsl:when>
                    <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:choose> 
                <xsl:when test="0" />
                <xsl:when test="not($dvt_groupfield) and (not($NewGroup_0='') and position() &gt;= $FirstRow and position() &lt;= $LastRow or ($FirstRow = position()))">
                    <xsl:variable name="groupheader0">
                        <xsl:choose> 
                            <xsl:when test="not (@_x0418__x0437__x0434__x0430__x04) and (@_x0418__x0437__x0434__x0430__x04) != false()"><xsl:value-of select="' '" /></xsl:when>
                            <xsl:otherwise><xsl:value-of select="@_x0418__x0437__x0434__x0430__x04" /></xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>
                    <xsl:if test="not ((position()=1) or (position()=$FirstRow))"></xsl:if>
                    <xsl:call-template name="dvt_1.groupheader0">
                        <xsl:with-param name="fieldtitle">Sredstvo koje se izdaje</xsl:with-param>
                        <xsl:with-param name="fieldname">_x0418__x0437__x0434__x0430__x04</xsl:with-param>
                        <xsl:with-param name="fieldvalue" select="$groupheader0" />
                        <xsl:with-param name="fieldtype" select="'text'" />
                        <xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[((@_x0418__x0437__x0434__x0430__x04)=$groupheader0 or ((not(@_x0418__x0437__x0434__x0430__x04) or @_x0418__x0437__x0434__x0430__x04='') and $groupheader0=' '))]" />
                        <xsl:with-param name="groupid" select="'0'" />
                        <xsl:with-param name="displaystyle" select="'auto'" />
                        <xsl:with-param name="imagesrc" select="'/_layouts/images/plus.gif'" />
                        <xsl:with-param name="alttext" select="'expand'" />
                        <xsl:with-param name="altname" select="'collapse'" />
                        <xsl:with-param name="hidedetail" select="true()" />
                        <xsl:with-param name="showheader" select="true()" />
                        <xsl:with-param name="showheadercolumn" select="false()" />
                    </xsl:call-template>
                </xsl:when>
            </xsl:choose>
            
            <xsl:variable name="BreakOut">
                <xsl:choose>
                    <xsl:when test="not($dvt_groupfield) and position()=$LastRow+1"><xsl:value-of select="ddwrt:NameChanged('', -1)" /></xsl:when>
                    <xsl:otherwise>BreakOut</xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            
            <xsl:variable name="dvt_KeepItemsTogether" select="false()" />
            
            <xsl:variable name="dvt_HideGroupDetail" select="true()" />
            
            <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">
                <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
                    <xsl:call-template name="dvt_1.rowview" />
                </xsl:if>
            </xsl:if>
            <xsl:choose> 
                <xsl:when test="0" />
            </xsl:choose>
            
        </xsl:for-each>
        
        
        
        
        
        
        
    </xsl:template>
    <xsl:template name="dvt_1.rowview">
        <xsl:variable name="dvt_GroupStyle" select="'none'" />
        <tr style="display:{$dvt_GroupStyle}">
            <xsl:if test="position() mod 2 = 1">
                <xsl:attribute name="class">ms-alternating</xsl:attribute>
            </xsl:if><td class="ms-vb">
                <xsl:value-of select="@_x0418__x0437__x0434__x0430__x04" disable-output-escaping="yes" /></td>
            <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
                <td class="ms-vb" width="1%" nowrap="nowrap">
                    <span ddwrt:amkeyfield="" ddwrt:amkeyvalue="string($XPath)" ddwrt:ammode="view"></span>
                </td>
            </xsl:if><td class="ms-vb">
                <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text>
            </td><td class="ms-vb">
                <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text>
            </td></tr>
        
    </xsl:template>
    <xsl:template name="dvt_1.empty">
        <xsl:variable name="dvt_ViewEmptyText">There are no items to show in this view.</xsl:variable>
        <table border="0" width="100%">
            <tr>
                <td class="ms-vb">
                    <xsl:value-of select="$dvt_ViewEmptyText"/>
                </td>
            </tr>
        </table>
    </xsl:template>
    <xsl:template name="dvt_1.commandfooter">
        <xsl:param name="FirstRow" />
        <xsl:param name="LastRow" />
        <xsl:param name="RowLimit" />
        <xsl:param name="dvt_RowCount" />
        <xsl:param name="RealLastRow" />
        <table cellspacing="0" cellpadding="4" border="0" width="100%">
            <tr>
                <xsl:if test="$FirstRow &gt; 1 or $LastRow &lt; $dvt_RowCount">
                    <xsl:call-template name="dvt_1.navigation">
                        <xsl:with-param name="FirstRow" select="$FirstRow" />
                        <xsl:with-param name="LastRow" select="$LastRow" />
                        <xsl:with-param name="RowLimit" select="$RowLimit" />
                        <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                        <xsl:with-param name="RealLastRow" select="$RealLastRow" />
                    </xsl:call-template>
                </xsl:if>
            </tr>
        </table>
    </xsl:template>
    <xsl:template name="dvt_1.navigation">
        <xsl:param name="FirstRow" />
        <xsl:param name="LastRow" />
        <xsl:param name="RowLimit" />
        <xsl:param name="dvt_RowCount" />
        <xsl:param name="RealLastRow" />
        <xsl:variable name="PrevRow">
            <xsl:choose>
                <xsl:when test="$FirstRow - $RowLimit &lt; 1">1</xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$FirstRow - $RowLimit" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="LastRowValue">
            <xsl:choose>
                <xsl:when test="$LastRow &gt; $RealLastRow">
                    <xsl:value-of select="$LastRow"></xsl:value-of>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$RealLastRow"></xsl:value-of>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="NextRow">
            <xsl:value-of select="$LastRowValue + 1"></xsl:value-of>
        </xsl:variable>
        <td nowrap="nowrap" class="ms-paging" align="right">
            <xsl:if test="$dvt_firstrow &gt; 1" ddwrt:cf_ignore="1">
                <a>
                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={1}')" />;</xsl:attribute>
                Start</a>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                <a>
                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$PrevRow,'}'))" />;</xsl:attribute>
                <img src="/_layouts/images/prev.gif" border="0" alt="Previous" />
                </a>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            </xsl:if>
            <xsl:value-of select="$FirstRow" />
             - <xsl:value-of select="$LastRowValue" />
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>
            
            <xsl:if test="$LastRowValue &lt; $dvt_RowCount or string-length($dvt_nextpagedata)!=0" ddwrt:cf_ignore="1">
                <a>
                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$NextRow,'}'))" />;</xsl:attribute>
                <img src="/_layouts/images/next.gif" border="0" alt="Next" />
                </a>
            </xsl:if>
        </td>
    </xsl:template>
    <xsl:variable name="dvt_2_automode">0</xsl:variable>
    <xsl:decimal-format decimal-separator="," grouping-separator="." name="lcid3098" />
    <xsl:template name="dvt_1.groupheader0">
        <xsl:param name="fieldtitle" />
        <xsl:param name="fieldname" />
        <xsl:param name="fieldvalue" />
        <xsl:param name="fieldtype" />
        <xsl:param name="nodeset" />
        <xsl:param name="groupid" />
        <xsl:param name="displaystyle" />
        <xsl:param name="imagesrc" />
        <xsl:param name="alttext" />
        <xsl:param name="altname" />
        <xsl:param name="hidedetail" />
        <xsl:param name="showheader" />
        <xsl:param name="showheadercolumn" />
        <xsl:if test="$showheader" ddwrt:cf_ignore="1">
            <tr id="group{$groupid}" style="display:{$displaystyle}">
                <td class="ms-gb" colspan="0" style="height: 1px; width: 261px;">
                    
                    <xsl:if test="not($hidedetail)" ddwrt:cf_ignore="1">
                        <a href="javascript:" onclick="javascript:ExpGroupBy(this);return false;">
                            <img src="{$imagesrc}" border="0" alt="{$alttext}" name="{$altname}" /></a>
                    </xsl:if>
                    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>
                    
                    
                    
                    <xsl:choose>
                        <xsl:when test="$fieldtype='url'">
                            <a href="{$fieldvalue}">
                                <xsl:value-of select="$fieldvalue" />
                            </a>
                        </xsl:when>
                        <xsl:when test="$fieldtype='user'">
                            <xsl:value-of select="$fieldvalue" disable-output-escaping="yes" />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="$fieldvalue" disable-output-escaping="yes" />   </xsl:otherwise>
                    </xsl:choose>
                </td>
                <td style="height: 1px; width: 164px; text-align:center;"><xsl:value-of disable-output-escaping="yes" select="count($nodeset)" /></td>
    <!--            <td style="height: 1px"><xsl:for-each select="/dsQueryResponse/Rows/Row"><xsl:value-of select="@_x041a__x043e__x043b__x0438__x04" disable-output-escaping="yes" /></xsl:for-each></td>
            --><td style="height: 1px"><xsl:for-each select="/dsQueryResponse/Rows/Row"><xsl:value-of select="@_x041a__x043e__x043b__x0438__x04" /></xsl:for-each></td>
            
            </tr>
        </xsl:if>
    </xsl:template>
    </xsl:stylesheet>    </XSL>


lista treba da izgleda kao na slici 1 ,a ja dobijam sa mojim kodom rezultate kao na slici 2.
Dakle, u svakoj polju kolone kolicina-pocetno stanje dobijam sve rezultate za izdata sredstva , trebalo bi da bude kao na slici 1 u koloni kolicina
Prikačeni fajlovi
 
Odgovor na temu

[es] :: XML :: xsl za prikaz tabele u sharepoint-u

[ Pregleda: 1691 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.