I'm speaking at OpenWorld 2017

Wednesday, 31 December 2014

PeopleSoft Portal: Introduction to XSL

At the UKOUG Apps 2014 conference in Liverpool I presented on the subject of "PeopleSoft Portal: Things you can do."....  I ran out of time and some of my live demo didn't work...  sorry folks.

One of the subjects we touched on was using XSL (eXtensible StyleSheet Language)  to tranform Pagelet content.  XSL may be a bit of a mystery to some..... so I wanted try and shed a bit of light on it.  I hope you find this helpful.

In the Pagelet Wizard - if you choose Custom as the Display Format then you can edit the XSL used to transform the data source XML (Query, Navigation Collection, etc).


One of the most frequent questions I get asked about this is "are there any tools for creating and editing XSL?".  The short answer to this is "Yes" but, at the end of the day XSL is a programming language and there's only so far tools will take you before you need to start learning the details of the language.

This blog (and maybe others to come) will hopefully get people started on the basics.

Let's first take a look at the XML produced by an example data source.  In this example I'm using a PS Query that's delivered with every PeopleSoft installation - XRFWIN.

  1. Use the Pagelet Wizard to create a new Pagelet with data source type of Query using XRFWIN and select Custom at the Display Format step.
  2. Depending on your PeopleTools release you will have a number of XSL Templates to choose from.  You can create your own in PeopleTools > Portal > Pagelet Wizard > Define XSL.
  3. Copy and past the XML text into a file and save it.
  4. Let's take a look at the structure of this data.  There are 3 main sections to this XML document:
    • HEADER - a single header in
    • DEFINITION - a collection of containing an element for each field in the Query definition.  In our example XRFWIN has only one fieldname.
    • DATA - a collection of elements containing the actual Query results.


  5. Now let's look at the XSL structure.  This is helpfully annotated by PeopleSoft with some useful comments.  I used the XSLtemplate called "Bullet List".  XSL is a mix of HTML and XSL instructions found in tags prefixed with
    • a main XSL template calls three other templates
      • a header template - /queryresult/queryfields
      • a detail rows template - /queryresult/queryrows
      • a footer template - /queryresult/queryproperties
      Bullet List XSL Template (sections have been collapsed in this views)

In working with XML and XSL it's useful to use a good, purpose built editor.  I use Altova Spy but there are other tools available (StylusStudio is the only other one I have some experience of).  If you're serious about working with XSL then it's worth investing in good tools.  Altova Spy has a very useful step through debugger.  Watch the video below for walk through the XRFWIN example.  It really is a great way to learn about XSL.


4 comments:

Jim Marion said...

Thank you for sharing this. I believe XSL transforms in Pagelet Wizard are one of the most powerful methods available for creating a compelling user experience.

William Prescot said...

XSL also transforms PS query and Connected Query into powerful report writers. With XSL they become viable alternatives to BI Publisher.

Graham said...

@william: Excellent suggestion. A variation on this theme was demonstrated by Jim Marion at OOW 2014 where he took responses from the PeopleSoft Query Access Service (QAS) and used Angular to render the output . You can see his high level look at this in his presentation slides here

GoBipUser said...

Hi Graham.

I see your fluid PS post, so, my question is you can do the navigation toolbar for Scroll Areas en ps pages with fluid technology.?

Thanks.