You are here

See the XML nested-tables.xsl is processing

Submitted by bsimpson on Tue, 09/02/2008 - 13:01

Anyone who has looked around on this website (or in certain section of documentation) for any length of time has probably come across nested-tables.xsl. This file is the "starting point" for the portal rendering. XSL works by taking an XML input file (generated from Java services), transforming it, and spitting out HTML as an end product. The result is what you see in your browser after you login to the portal.

We can see nested-tables.xsl because it isn't compiled (*cough Java cough*), but I have been going crazy trying to figure out what attributes are available inside the XML that it processes, and how it is structured.

Getting the XML to show up may be a no-brainer for someone with experience in XSL, but since the world went with CSS instead, I am going to wager that this isn't as straight forward for most of the people here.

The answer to seeing our XML file is simple really, we will just swap out our nested-tables.xsl code for some alternate code instead. Instead of transforming the XML, we will spit it out to the screen pretty much as-is (indentions, and things aside)

To accomplish this, navigate to "$CP_WEBINF/uPortal/org/jasig/portal/layout/tab-column/nested-tables/". Next, (and this is IMPORTANT) make a backup of your nested-tables.xsl file. Ex: "cp nested-tables.xsl nested-tables.original.xsl".

Now, open up nested-tables.xsl, and delete everything replacing it with this:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" /> <!-- here's the trick -->

    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="@*" />
            <xsl:apply-templates />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="comment()|processing-instruction()">
        <xsl:copy />
    </xsl:template>

</xsl:stylesheet>

Save your file, then restart the web server. Ex: "$CP_ROOT/bin/rc/70-webserver stop && $CP_ROOT/bin/rc/70-webserver start".

After the web server comes back up, log in and view the source of the page. What you are looking at is the XML input file in a close to original format. Unfortunately, the channel's HTML clutters up XML source, but you can hopefully work around that...

When you are finished, swap out the backup file with the modified file, and restart your web server again, and everything will be back to normal. Ex: "cp nested-tables.original.xsl nested-tables.xsl && $CP_ROOT/bin/rc/70-webserver stop && $CP_ROOT/bin/rc/70-webserver start"

PS: This isn't one to try in production since the change is global!

Luminis Version:

Channels:

How-To:

Comments

dear Ben,
Very nice article...
I'm a functional consultant.
Can I have ur contact in order to benefit from ur technical skills?
my email is : hmalla@hotmail.com.
Regards