First of all, I am new to XSLT. I am working with the Sharepoint list and receive a link to show me There is a need to do if data exists in specific quarters. If there is no data in a certain quarter, then I should have a label that says so.
So what have I done that I created a foreach loop for every data of the same month of a given year. I know that I can not open a variable in XSLT, but I do not know how to do it I need it. Here is a sample of my code as I am working with SharePoint, so I do not have access to XML. I: /
      & lt; xsl: variable name = Select "DataQ3" = "'Incorrect" /> & Lt; Select xsl: variable name = "DataQ4" = "'false'" /> & Lt; Xsl: each selection = "../ line [Generate-ID () = Generate-ID (key ('month', subdiver (date @ 6, 7)) [substring ('@ date', 1, 4) = $ VarYear)] [1])] "& gt; & Lt; Select xsl: variable name = "currentMonth" = "number (substring (date @ 6,7)" /> & Lt; XSL: Select & gt; & Lt; Xsl: when testing = "$ current mont & gt; = 1 and $ current churn $ lt; = 4" & gt; & Lt ;! - Set $ DataQ1 right - & gt; & Lt; / XSL: When & gt; & Lt; Xsl: When testing = "$ current churn> = 4 and $ current churn $ lt; = 7" & gt; & Lt ;! - Set $ DataQ2 correct - & gt; & Lt; / XSL: When & gt; & Lt; Xsl: when test = "$ current churning = 7 and $ current churn $ lt; = 10" & gt; & Lt ;! - Set $ DataQ3 correct - & gt; & Lt; / XSL: When & gt; & Lt; XSL: otherwise & gt; & Lt ;! - Set $ DataQ4 correct - & gt; & Lt; / XSL: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: for-each & gt; & Lt; Div & gt; & Lt; XSL: Select & gt; & Lt; Xsl: when test = "$ DataQ1 = 'true'" & gt; & Lt; A & gt; & Lt; Xsl: attribute name = "href" & gt; & Lt; Xsl: Select the value = "www.example.come" /> & Lt; / XSL: Specialty & gt; & Lt; Xsl: Select Value = "'Linked DotDefault Q1'" /> & Lt; / A & gt; & Lt; / XSL: When & gt; & Lt; XSL: otherwise & gt; & Lt; Xsl: Select the value = "'There is no data for this quarter.'" /> & Lt; / XSL: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / Div & gt;     
  You use the  key  function in your code You did not post the announcement of your key but I think you can get it from the following code:    & lt; Div & gt; & Lt; XSL: Select & gt; & Lt; Xsl: When test = "../ line [substrings (date, 1, 4) = $ varYear and substrings (date, 6, 2) & amp; gt; = 1 more substring (date, 6, 2) & Amp; 4; "& gt; & Lt; A href = "http://www.example.com/" & gt; Linkotodonta Q1 & lt; / A & gt; & Lt; / XSL: When & gt; & Lt; Xsl: otherwise & gt; There is no data for this quarter. & Lt; / Xsl: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / Div & gt;    Some other notes:  
 -  In your testing for Q1, you entered 
 $ currentMonth & lt; = 4  is written. I think what you want  $ currentMonth & lt; 4 .  substring (@Date, 6, 7)  has been used to remove  @ date  from the month  - . The third argument for 
 substrings  is the length of the sub-row, not the end index. You might want to  suborg (date, 6, 2) .  -  
 and , you can just type  string .    
 
     
No comments:
Post a Comment