MergeGemstoneVirtualCMS.xsl

Build 1501 on 14/Nov/2017  This topic last edited on: 24/Oct/2016, at 13:07

<?xml version="1.0"?>

<!--

  Transformation to generate a list of mapping between VirtualCMS

  sections and Gemstone/FutureProof classifications, to be merged in

  the wf_createVCAds.xml workflow.

 

  This XSLT has to run against a list of Gemstone classifications in

  this format:

  <root>

    <classification short_name="PLet" long_name="Property to Let"/>

    ....

   </root>

   that has been generated from the Gemstone Database. The XSLT loads

   the VirtualCMS sections from a file, VCSections.xml (in the same

   folder) which has been loaded as:

        http://XXXX/GNWebDo.jsp?cmd=getsections&format=xml

   where XXXX is the URL of the VirtualCMS website.

 

   The resulting XML has to be merged in the GN4 workflow.

 

   Copyright (C) Miles 33 Ltd. - 2016

-->

 

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

 

<!-- This file is the list of sections from the VC Website -->

<xsl:variable name="VCSections" select="document('VCSections.xml')"/>

 

<!-- Don't touch anything below this point -->

<xsl:output encoding="utf-8" indent="yes" method="xml"/>

<xsl:template match="/">

    <root>

        <xsl:apply-templates/>

    </root>

</xsl:template>

 

<xsl:template match="classification">

   <xsl:element name="{name()}">

       <xsl:variable name="GemName" select="@long_name"/>

       <xsl:copy-of select="./@*"/><!-- copy existing attributes -->

       <xsl:if test="$VCSections/sections/section[name=$GemName]">

          <xsl:attribute name="vcId">

            <xsl:value-of select="$VCSections/sections/section[name=$GemName]/id"/>

           </xsl:attribute>

       </xsl:if>

   </xsl:element>

</xsl:template>

 

</xsl:stylesheet>