XSLT Format

Fernando's Avatar

Fernando

18 May, 2015 04:30 PM

I am currently working on an XSLT format for my website and I am trying to implement this tab functionality. The only problem I come across is that whenever I write content on the tab it does not recognize HTML on it. Here is the format:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
    column-2
    Created by Ross Williams on 2010-10-25.
    Copyright (c) 2010 Hannon Hill Corp. All rights reserved.
    Updated by Hannon Hill on 2014-06-18.
--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
    <xsl:include href="/_internal/formats/redesign/sidebar-modules.inc"/>
    
      <xsl:variable name="nav" select="/system-index-block/calling-page/system-page/dynamic-metadata[name='displayNav']/value/text()"/>
      <xsl:variable name="right" select="/system-index-block/calling-page/system-page/dynamic-metadata[name='rightSidebar']/value/text()"/>
      
    <xsl:template match="/system-index-block">
        <xsl:apply-templates select="calling-page/system-page/system-data-structure"/>
    </xsl:template>
    
    <xsl:template match="system-data-structure">
        <xsl:choose>
            <xsl:when test="$nav = 'On' and $right = 'Yes'">
                <div class="col-md-7 main-content">
                    <xsl:copy-of select="content/node()"/>
                     <xsl:if test="tabGroup/tab[header != '']">
                            <ul class="nav nav-tabs">
                                 <xsl:apply-templates mode="tabHead" select="tabGroup/tab[header != '']"/>
                            </ul>
                           <div class="tab-content">
                                <xsl:apply-templates mode="tabContent" select="tabGroup/tab[content != '']"/>
                            </div>
                    </xsl:if>
                </div>
            </xsl:when>
            <xsl:when test="$nav = 'Off' and $right = 'Yes'">
                <div class="col-md-10 main-content">
                    <xsl:copy-of select="content/node()"/>
                     <xsl:if test="tabGroup/tab[header != '']">
                            <ul class="nav nav-tabs">
                                 <xsl:apply-templates mode="tabHead" select="tabGroup/tab[header != '']"/>
                            </ul>
                           <div class="tab-content">
                                <xsl:apply-templates mode="tabContent" select="tabGroup/tab[content != '']"/>
                            </div>
                    </xsl:if>
                </div>
            </xsl:when>
            <xsl:when test="$nav = 'On' and $right = 'No'">
                <div class="col-md-9 main-content">
                    <xsl:copy-of select="content/node()"/>
                     <xsl:if test="tabGroup/tab[header != '']">
                            <ul class="nav nav-tabs">
                                 <xsl:apply-templates mode="tabHead" select="tabGroup/tab[header != '']"/>
                            </ul>
                           <div class="tab-content">
                                <xsl:apply-templates mode="tabContent" select="tabGroup/tab[content != '']"/>
                            </div>
                    </xsl:if>
                </div>
            </xsl:when>
            <xsl:otherwise>
                <div class="col-md-12 main-content">
                    <xsl:copy-of select="content/node()"/>
                     <xsl:if test="tabGroup/tab[header != '']">
                            <ul class="nav nav-tabs">
                                 <xsl:apply-templates mode="tabHead" select="tabGroup/tab[header != '']"/>
                            </ul>
                           <div class="tab-content">
                                <xsl:apply-templates mode="tabContent" select="tabGroup/tab[content != '']"/>
                            </div>
                    </xsl:if>
                </div>
            </xsl:otherwise>
        </xsl:choose>
        
        
            <xsl:if test="related/links[page/content or link/content or links-list/content/system-data-structure[page/content or link/content]]  or related[callout-block/content or callout/node()]">
                <div class="col-md-2">
                  <xsl:apply-templates select="related/links[page/content or link/content or links-list/content/system-data-structure[page/content or link/content]]"/>
                  <xsl:apply-templates select="related"/>
                </div>
            </xsl:if>
    </xsl:template>
    
          <xsl:template match="tab" mode="tabHead">
        <xsl:variable name="starter" select="0"/>
        <xsl:variable name="count" select="$starter + position()"/>
            <xsl:choose>
                <xsl:when test="$count = '1'">
                    <li class="active">
                        <a data-toggle="tab" href="#{$count}">
                            <xsl:value-of select="header"/>
                        </a>
                    </li>
                </xsl:when>
                <xsl:otherwise>
                    <li>
                        <a data-toggle="tab" href="#{$count}">
                            <xsl:value-of select="header"/>
                        </a>
                    </li>
                </xsl:otherwise>
            </xsl:choose>
    </xsl:template>
    <xsl:template match="tab" mode="tabContent">
        <xsl:variable name="starter" select="0"/>
        <xsl:variable name="count" select="$starter + position()"/>
            <xsl:choose>
                <xsl:when test="$count = '1'">
                    <div class="tab-pane active" id="{$count}">
                        <xsl:value-of select="content/node()"/>
                    </div>
                </xsl:when>
                <xsl:otherwise>
                    <div class="tab-pane" id="{$count}">
                        <xsl:value-of select="content/node()"/>
                    </div>
                </xsl:otherwise>
            </xsl:choose>
     </xsl:template>

    
</xsl:stylesheet>

and here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<system-index-block name="calling page" type="folder" current-time="1431966641401">
    <calling-page>
        <system-page id="e59dd66a80ce0e9a60321a40741645e6" current="true">
            <name>applications</name>
            <title>Applications</title>
            <display-name>Applications</display-name>
            <path>/applications</path>
            <site>Office of Admissions</site>
            <link>site://Office of Admissions/applications</link>
            <dynamic-metadata>
                <name>navigation</name>
                <value>No</value>
            </dynamic-metadata>
            <dynamic-metadata>
                <name>rightSidebar</name>
                <value>No</value>
            </dynamic-metadata>
            <dynamic-metadata>
                <name>displayNav</name>
                <value>On</value>
            </dynamic-metadata>
            <system-data-structure definition-path="Unit Secondary Page">
                <cta>No</cta>
                <content>
                    <div />
                    <table border="1" cellspacing="10">
                        <tbody>
                            <tr>
                                <td align="center" colspan="3">
                                    <h3 align="center" class="yellow">
                                        <strong>Undergraduate Applications</strong>
                                    </h3>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for First Time Freshmen and Transfer Students</strong>&amp;#160;
                                    </p>
                                </td>
                                <td align="center">&amp;#160;
                                    <a href="site://Office of Admissions/apply-now">Online</a>&amp;#160;
                                </td>
                                <td align="center">&amp;#160;
                                    <a href="site://Office of Admissions/files/pdfs/UndergraduateApplication.pdf" title="Undergraduate Application">PDF</a>&amp;#160;
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for Returning Undergraduate Students</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/apply-now">Online</a>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/files/pdfs/Re-Enroll App.pdf" target="_blank" title="UMSL Re-Enrollment Application">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for Undergraduate Non-Degree Seeking Students</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/apply-now">Online</a>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/files/pdfs/Visiting_Non-Degree App" target="_blank" title="Visiting and Non-Degree Application">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for Visiting Students</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="https://myview.umsl.edu/psp/prdpr/EMPLOYEE/HRMS/c/UM_ADMISSIONS.UM_WEB_APP_LOGIN.GBL?AITS_HDR_CODE=13&amp;IsFolder=false&amp;campus=VSASTLOU" target="_blank" title="Application for Visiting Students">Online</a>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/files/pdfs/Visiting_Non-Degree App" target="_blank" title="Visiting and Non-Degree Application">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for International Students</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/http://www.umsl.edu/&amp;#126;intelstu/prospectivestudents/Apply Now.html" target="_blank">Online</a>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/http://www.umsl.edu/&amp;#126;intelstu/Prospective Students/UMSL Undergraduate Application.pdf" target="_blank" title="Application for International Students">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="3">
                                    <h3 align="center" class="yellow">
                                        <strong>Graduate &amp; Professional Applications</strong>
                                    </h3>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application Graduate Students</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="site://Office of Admissions/apply-now">Online</a>
                                </td>
                                <td align="center">&amp;#160;--</td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for UM Visiting Graduate Students</strong>
                                    </p>
                                </td>
                                <td align="center">&amp;#160;--</td>
                                <td align="center">
                                    <a href="site://Office of Admissions/files/pdfs/UM Visiting Graduate Application" target="_blank" title="UM Visiting Graduate Student Application">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for College of Optometry</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="http://www.umsl.edu/divisions/optometry/Students/prospstudpag.html">Online</a>
                                </td>
                                <td align="center">&amp;#160;--</td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Application for Masters of Social Work and supplemental materials</strong>
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="http://www.umsl.edu/&amp;#126;socialwk/Apply/apply-MSW.html" target="_blank" title="Application for MSW and supplemental materials">Online</a>
                                </td>
                                <td align="center" />
                            </tr>
                            <tr>
                                <td align="center" colspan="3">
                                    <h3 align="center" class="yellow">
                                        <strong>Supplemental Applications</strong>
                                    </h3>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>Pierre Laclede Honors College -- Supplemental Application
                                            <br />
                                        </strong> (to be submitted after the standard undergraduate application form)
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="http://www.umsl.edu/divisions/honors/Future%20Students/stepstoapply.html" target="_blank" title="Honors College Supplemental Application">Online</a>
                                </td>
                                <td align="center" class="table-responsive">
                                    <a href="http://www.umsl.edu/divisions/honors/pdfs/application_plhc.pdf">PDF</a>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>College of Nursing -- Supplemental Application
                                            <br />
                                        </strong> (to be submitted after the standard University application)
                                    </p>
                                </td>
                                <td align="center">
                                    <a href="http://www.umsl.edu/divisions/nursing/how-to-apply.html" target="_blank" title="College of Nursing Supplemental Application">Online
                                        <br />
                                    </a>
                                </td>
                                <td align="center">&amp;#160;--</td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <p>
                                        <strong>UMSL Express -- for Senior Citizens (65 &amp; older)
                                            <br />
                                        </strong> (for undergraduate courses on a not-for-credit, space available basis)
                                    </p>
                                </td>
                                <td align="center">&amp;#160;--</td>
                                <td align="center">
                                    <a href="//files/pdfs/UMSL%20Express.pdf" title="UMSL Express application">PDF</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </content>
                <related>
                    <links>
                        <links-list type="block">
                            <content>
                                <system-data-structure>
                                    <page type="page">
                                        <content />
                                        <path>/apply-now</path>
                                        <dynamic-metadata>
                                            <name>navigation</name>
                                            <value>No</value>
                                        </dynamic-metadata>
                                        <dynamic-metadata>
                                            <name>rightSidebar</name>
                                            <value>Yes</value>
                                        </dynamic-metadata>
                                        <dynamic-metadata>
                                            <name>displayNav</name>
                                            <value>Off</value>
                                        </dynamic-metadata>
                                        <link>site://Office of Admissions/apply-now</link>
                                        <site>Office of Admissions</site>
                                        <name>apply-now</name>
                                        <display-name> Apply Now</display-name>
                                        <title>Apply Now</title>
                                    </page>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>https://umsl.askadmissions.net/emtinterestpage.aspx?ip=undergraduate</system-symlink>
                                        </content>
                                        <path>/files/external-links/Request Info</path>
                                        <site>Office of Admissions</site>
                                        <name>Request Info</name>
                                    </link>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>https://myview.umsl.edu/psp/prd/?cmd=login&amp;languageCd=ENG&amp;</system-symlink>
                                        </content>
                                        <path>/files/external-links/Check Application Status</path>
                                        <site>Office of Admissions</site>
                                        <name>Check Application Status</name>
                                    </link>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>http://www.umsl.edu/cashiers/tuition-fees/index.html</system-symlink>
                                        </content>
                                        <path>/files/external-links/Tuition and Fees</path>
                                        <site>Office of Admissions</site>
                                        <name>Tuition and Fees</name>
                                    </link>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>http://www.umsl.edu/divisions/graduate/.</system-symlink>
                                        </content>
                                        <path>/files/external-links/Graduate</path>
                                        <site>Office of Admissions</site>
                                        <name>Graduate</name>
                                    </link>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>http://www.umsl.edu/~intelstu/prospectivestudents/index.html</system-symlink>
                                        </content>
                                        <path>/files/external-links/International</path>
                                        <site>Office of Admissions</site>
                                        <name>International</name>
                                    </link>
                                    <link type="symlink">
                                        <content>
                                            <system-symlink>http://www.umsl.edu/divisions/optometry/Academic%20Programs/Admissions/applying.html</system-symlink>
                                        </content>
                                        <path>/files/external-links/Optometry</path>
                                        <site>Office of Admissions</site>
                                        <name>Optometry</name>
                                    </link>
                                </system-data-structure>
                            </content>
                            <path>/files/blocks/Undergraduate Related Links</path>
                            <site>Office of Admissions</site>
                            <name>Undergraduate Related Links</name>
                        </links-list>
                        <page>
                            <path>/</path>
                        </page>
                        <link>
                            <path>/</path>
                        </link>
                    </links>
                    <heading />
                    <callout>This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.&amp;#160;This is an example text.</callout>
                    <callout-block>
                        <path>/</path>
                    </callout-block>
                </related>
                <tabGroup>
                    <tab>
                        <header>text 1</header>
                        <content>
                            <p>text 5</p>
                            <p>text 6</p>
                            <p>text 7</p>
                            <p>text 8</p>
                            <p>
                                <img alt="" height="160" src="site://Office of Admissions/files/images/Staff Photos/Alan.jpg" width="115" />
                            </p>
                        </content>
                    </tab>
                    <tab>
                        <header>text 2</header>
                        <content>
                            <p>text 1</p>
                            <p>text 6</p>
                            <p>text 7</p>
                            <p>text 8</p>
                        </content>
                    </tab>
                </tabGroup>
            </system-data-structure>
        </system-page>
    </calling-page>
</system-index-block>
  1. 1 Posted by Fernando on 19 May, 2015 01:57 PM

    Fernando's Avatar

    To be more specific I added content in the data definition and added some contents to the "Tabs" section and as you can see in the other screen shot it doesnt portray all of the content i added to it. What leads me to believe that it does not read HTML but i could be wrong.

    Thanks for the help!

  2. 2 Posted by Fernando on 21 May, 2015 01:11 PM

    Fernando's Avatar

    I was able to resolve the problem. I use this link http://help.hannonhill.com/discussions/general/613-html-tags-in-xslt as reference and in my XSLT format I replace: "<xsl:value-of select="content/node()"/> for <xsl:copy-of select="content/node()"/>". And that took care of the problem

  3. Fernando closed this discussion on 21 May, 2015 01:11 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac