Список XSL для SharePoint не выводится - PullRequest
0 голосов
/ 13 марта 2019

У меня есть список SharePoint, для которого мне нужно создать собственную таблицу стилей.Я не могу получить никакого вывода из этого.

Образец из формы Infopath:

<xsl:for-each
select="xdXDocument:GetDOM(&quot;BusinessArea&quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW">
<option>
    <xsl:attribute name="value">
        <xsl:value-of select="d:Title" />
    </xsl:attribute>
    <xsl:if test="$val=d:Title">
        <xsl:attribute name="selected">selected</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="d:Title" />
</option>
</xsl:for-each>

<td style="VERTICAL-ALIGN: middle; BORDER-LEFT-COLOR: ; PADDING-BOTTOM: 4px; PADDING-TOP: 4px"
class="xdTableMiddleCellEmphasis">
<span class="xdlabel"></span>
<span title="" class="xdTextBox xdBehavior_Formatting" hideFocus="1"
    contentEditable="true" tabIndex="0" xd:boundProp="xd:num"
    xd:binding="dfs:dataFields/my:SharePointListItem_RW/my:OPJan"
    xd:CtrlId="CTRL1" xd:xctname="PlainText"
    xd:datafmt="&quot;number&quot;,&quot;numDigits:auto;negativeOrder:1;&quot;"
    style="WIDTH: 100%">
    <xsl:attribute name="xd:num">
        <xsl:value-of select="dfs:dataFields/my:SharePointListItem_RW/my:OPJan" />
    </xsl:attribute>
    <xsl:choose>
        <xsl:when test="function-available('xdFormatting:formatString')">
            <xsl:value-of
                select="xdFormatting:formatString(dfs:dataFields/my:SharePointListItem_RW/my:OPJan,&quot;number&quot;,&quot;numDigits:auto;negativeOrder:1;&quot;)" />
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="dfs:dataFields/my:SharePointListItem_RW/my:OPJan" />
        </xsl:otherwise>
    </xsl:choose>
</span>
</td>

XSL для того же:

<xsl:stylesheet version="1.0" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2009/WSSList/cmeDataFields" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xdExtension="http://schemas.microsoft.com/office/infopath/2003/xslt/extension" xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" xmlns:xdSolution="http://schemas.microsoft.com/office/infopath/2003/xslt/solution" xmlns:xdFormatting="http://schemas.microsoft.com/office/infopath/2003/xslt/formatting" xmlns:xdImage="http://schemas.microsoft.com/office/infopath/2003/xslt/xImage" xmlns:xdUtil="http://schemas.microsoft.com/office/infopath/2003/xslt/Util" xmlns:xdMath="http://schemas.microsoft.com/office/infopath/2003/xslt/Math" xmlns:xdDate="http://schemas.microsoft.com/office/infopath/2003/xslt/Date" xmlns:sig="http://www.w3.org/2000/09/xmldsig#" xmlns:xdSignatureProperties="http://schemas.microsoft.com/office/infopath/2003/SignatureProperties" xmlns:ipApp="http://schemas.microsoft.com/office/infopath/2006/XPathExtension/ipApp" xmlns:xdEnvironment="http://schemas.microsoft.com/office/infopath/2006/xslt/environment" xmlns:xdUser="http://schemas.microsoft.com/office/infopath/2006/xslt/User" xmlns:xdServerInfo="http://schemas.microsoft.com/office/infopath/2009/xslt/ServerInfo">
<xsl:output method="html" encoding="utf-8" />

<xsl:template match="/">
    <xsl:variable name="dvt_RowCount“ select=”count($Rows)" />
    <html>
        <body>
            <h2>Test</h2>
            <table border="1">
                <tr>
                    <th>Title</th>
                </tr>
                <xsl:for-each
                    select="dfs:myFields/dfs:dataFields/my:SharePointListItem_RW">
                    <tr>
                        <td>
                            <xsl:value-of select="@my:Title" />
                        </td>
                    </tr>
                </xsl:for-each>
            </table>
        </body>
    </html>
</xsl:template>
</xsl:stylesheet>

У меня есть список Sharepoint, гдеМне нужно создать собственную таблицу стилей для этого списка.Мне нужно перебрать каждый элемент списка и вывести значение.В настоящее время я получаю заголовок как выходной.Я не могу получить какие-либо значения.Пожалуйста, помогите мне получить вывод.

1 Ответ

0 голосов
/ 26 марта 2019

Я нашел ответ на это.Это может быть полезно для других.

            <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" 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:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema">
            <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
            <table border="1">
            <tr>
                <td>Title</td>
            </tr>

            <xsl:for-each select="$Rows">
            <xsl:call-template name="dvt_1.rowview" />
            </xsl:for-each>
            </table>
            </xsl:template>

            <xsl:template name="dvt_1.rowview">
            <tr>

                <td><xsl:value-of disable-output-escaping="yes" select="@Title"/></td>

            </tr>
            </xsl:template>
            </xsl:stylesheet>
...