sharepoint 2010 problem with coloring background list cell with xslt

gogi100 51 Reputation points
2021-06-30T19:16:02.17+00:00

i have a list with column has some values: 8100 and 7800. i need xslt that i want loop through column and the cell that has smallest value colored yellow color. my code is

<xsl:variable name="MinValue" select="ddwrt:Min(/dsQueryResponse/Rows/Row/@_x0410__x043a__x043e__x043d__x040)" />


<xsl:for-each select="$Rows[@_x0410__x043a__x043e__x043d__x040=$MinValue]" > 

                 <xsl:attribute name="style">background-color:Yellow;color:White;</xsl:attribute>

      </xsl:for-each>

the variable MinValue received value 7800 but filter does not works $Rows[@_x0410__x043a__x043e__x043d__x040=$MinValue]

what i do?

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,971 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,608 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,031 Reputation points
    2021-07-01T06:55:20.44+00:00

    Hi @gogi100 ,

    How do you declare the variable $Rows? If you remove the filter, would it work.

    And you could try this: /dsQueryResponse/Rows/Row[@_x0410__x043a__x043e__x043d__x040=$MinValue]

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. gogi100 51 Reputation points
    2021-07-01T11:02:22.037+00:00

    picture in the 110981-untitled.jpgdesigner

    0 comments No comments

  3. gogi100 51 Reputation points
    2021-07-02T06:55:12.42+00:00

    i tryed with next code

      	<xsl:template name="FieldRef_Text_body._x0410__x043a__x043e__x043d__x040" ddwrt:dvt_mode="body" match ="FieldRef[@Name='_x0410__x043a__x043e__x043d__x040']" mode="Text_body" >  
            	<xsl:param name="thisNode" select="."/>  
           
        <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />  
        <xsl:variable name="CountRows" select="count($Rows)" />  
        <xsl:variable name="FirstRow" select="1" />  
          
        <xsl:variable name="NajmanjaVrednost">  
            	<xsl:for-each select="$Rows">    
                            <xsl:sort data-type="number" order="ascending" select="number($Rows/@_x0410__x043a__x043e__x043d__x040)" />    
                            <xsl:if test="position()= $FirstRow">    
                                <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" />   
                            </xsl:if>    
                        </xsl:for-each>  
            	</xsl:variable>  
          
              
            <xsl:choose>  
              		<xsl:when test="@AutoHyperLink='TRUE'">  
              		     
                <xsl:value-of select="$NajmanjaVrednost" disable-output-escaping="yes" />  
               <!-- <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping ="yes" /> -->  
                  
               
              </xsl:when>  
              		<xsl:otherwise>  
                 <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" />   
                <!--  <xsl:value-of select="$NajmanjaVrednost" /> -->  
          
              </xsl:otherwise>  
            	</xsl:choose>  
        </xsl:template>  
    

    but nothing.

    0 comments No comments

  4. gogi100 51 Reputation points
    2021-07-02T12:53:04.923+00:00

    i resolved problem partly using conditional formating in the sharepoint designer 2010 with next code on <tr> tag

    contains($thisNode/@_x0410__x043a__x043e__x043d__x040, ddwrt:Min(/dsQueryResponse/Rows/Row/@_x0410__x043a__x043e__x043d__x040[contains($thisNode/@_x0421__x0443__x0431__x0458__x04,$Rows/@_x0421__x0443__x0431__x0458__x04)]))  
    

    i received next list picture
    111346-untitled.jpg

    but i want solution where i receive the yellow row per grouping field. the grouped field is '@_x0421__x0443__x0431__x0458__x04'. the field ;@_x0410__x043a__x043e__x043d__x040' is 'Аконтација - укупно'

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.