Mabilis at madali: I-embed ang isang hyperlink sa view ng data web bahagi XSLT

I-UPDATE (01/17/08): Ang blog entry uusap tungkol sa mas kabutihan hyperlink XSL: http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/rewriting-links-in-search-results-xslt.

Pangkalahatang-ideya at Layunin: I had created a simple bar chart to serve as component on a dashboard. I’ll save the details on building charts for another post, ngunit hindi ko na kumatha diskarteng (o ang mga tandang pananong, para sa na mahalaga). It turned out there was a bug in the chart and while I fixed that, I took the opportunity to convert some labels into hyperlinks that pointed at the underlying list behind the graph. Halimbawa, there is a label with value "Hold". I wanted to turn the label into a hyperlink so that the user could click on it and drill down to the specific entries in the list whose status value is "Hold".

Mga Hakbang:

  1. Gamitin ang visual studio para sa sharepoint-aware intellisense.
  2. Kopyahin ang DVWP ni XSLT sa visual studio (lumikha ng isang blangko proyekto, magdagdag ng isang XSL file sa proyekto).
  3. Kopyahin ang link na gusto mong gamitin sa clipboard.
  4. Ilagay ito sa tamang lokasyon sa XSL.
  5. Convert URL argument separators on the query string from "&" to "&"
  6. Url-encode ang mga indibidwal na mga argumento.
  7. Pakibalot na sa loob ng isang <a href…> </isang>

Halimbawa:

Mayroon akong isang URL:

http://[server]/[lugar]/Listahan / Buksan ang% 20Positions/AllItems.aspx?Tingnan ={84EEA2F5-121B-40B7-946F-0FA704A1DAA1}&FilterField1 = Recruiter&FilterValue1 = Hold

I-convert ito sa:

     <isang href="Listahan / Buksan ang% 20Positions/AllItems.aspx?Tingnan =% 7b84EEA2F5-121B-40B7-946F-
0FA704A1DAA1% 7a&amp;FilterField1 = Recruiter&amp;FilterValue1 = Hold"> Hawakan: </isang>

Manu-mano ko pa transformed ang unang argumento mula sa:

{84EEA2F5-121B-40B7-946F-0FA704A1DAA1}

upang:

%7b84EEA2F5-121B-40B7-946F-0FA704A1DAA1% 7a

(Sa ganitong, Bukas ang suhay transforms sa% 7b at ang pangwakas suhay transforms sa% 7a)

Ang pangalawa at pangatlong argumento’ mga parameter ("FilterField1=Recruiter" and "FilterValue1=Hawakan" buong galang) hindi kailangang ma-url-encode nang dahil hindi sila naglalaman ng anumang hindi ligtas na mga character.

Mga Tala:

Diskarteng ito ay dapat pangkalahatan ay gumagana sa kahit saan nais mong i-embed ng isang hyperlink sa XSLT hyperlink kung saan ang may kasamang mga parameter sa URL tulad ng:

http://[server]/[lugar]/Listahan / Buksan ang% 20Positions/AllItems.aspx?Tingnan ={84EEA2F5-121B-40B7-946F-0FA704A1DAA1}&FilterField1 = Recruiter&FilterValue1 = Hold

Nakatanggap ako ang URL mismo sa pamamagitan ng pag-access ang listahan ng custom at mano-manong pag-filter sa hanay ng katayuan (labeled "Recruiter" sa itaas).

6 ano sa tingin mo "Mabilis at madali: I-embed ang isang hyperlink sa view ng data web bahagi XSLT

  1. Paul Galvin

    Cristina, that 84EE.. is a GUID that uniquely identifies the list internally. You can get it by pulling up the view in your browser and inspecting the URL of your browser.

    Sumagot
  2. Cristina Perez Otaiza

    where or how do generate this code ’84EEA2F5-121B-40B7-946F-0FA704A1DAA1′

    Could be possible to do this …&FilterField1=Recruiter Center &FilterValue1=Hold CE / ASM?

    O
    Do i need to remove the spaces between them?

    Sumagot
  3. Eric Anderson
    Do you have any suggestions for the situation where you want to pass data from a SharePoint list as the FilterValue1 value, and where the value in the column may contain ampersands? (I’ve tried numerous ways to encode/escape the value, but am not having a lot of luck in passing it properly.)
    Sumagot
  4. Costas Tsaklas
    I saw the example at the Help Desk application in the ‘fab 40’. The problem I don’t know how it was generated and that’s why I’m looking forward to the steps on how to do it
    Sumagot
  5. Paul Galvin
    I didn’t invent it, but it’s strange how difficult it is to find.
    I came across a functional example of this I think from one of the "fab 40" templates.
    It’s data view web part with XSLT that generates a graph. I definitely plan to do a post on it.
    Sumagot
  6. Costas Tsaklas
    I’m looking forward to the post about creating a chart. I have been looking for information on how to create charts based on lists (e.g open, closed issues, percentages etc.) and I can’t find any. Salamat
    Sumagot

-Iwan ng sagot

Ang iyong email address ay hindi nai-publish. Mga kinakailangang patlang ay minarkahan *