View Single Post
  #3 (permalink)  
Old August 29th, 2019, 03:49 AM
msambasiva@gmail.com msambasiva@gmail.com is offline
Registered User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2017
Posts: 9
Thanks: 3
Thanked 0 Times in 0 Posts
Default

<serviceReference>
<services>
<service anchor="com.apps.cdm.foundation.resources.resource ServiceV2.SalesPersonService">
<name>Sales Person Setup</name>
<someelements>some content</someelements>
</service>
<service anchor="com.apps.cdm.foundation.resources.resource Service.SalesPersonService">
<name>Sales Person Setup</name>
<someelements>different content</someelements>
</service>

</services>
</serviceReference>

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
exclude-result-prefixes="#all">

<xsl:template match="/">
<xsl:variable name="inpath" select="string-join(tokenize(document-uri(/), '/')[position() lt last()], '/')"/>
<xsl:variable name="docpath">
<xsl:value-of select="tokenize(document-uri(/), '/')[last()-1]"/>
</xsl:variable>
<xsl:variable name="indexGroupingKey" select="6"/>
<!-- Iterate through all the service data objects to prepare dita map container -->
<xsl:if test="count(//serviceReference/services/service) &gt; 0">
<xsl:for-each select="//serviceReference/services/service">

<xsl:sort select="name"/>
<xsl:variable name="topic_id_svc">
<!--takes the name and strips special chars,etc -->
<xsl:call-template name="generatename">
<xsl:with-param name="title">
<xsl:value-of select="name"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="topic_name_svc">
<!--passes the name string and appends a dash and id to give unique id -->
<xsl:call-template name="generateid">
<xsl:with-param name="title">
<xsl:value-of select="substring($topic_id_svc,1,50)"/>
</xsl:with-param>
<!--Concatenate title, some are very long -->
<xsl:with-param name="genid">
<xsl:value-of select="generate-id(name)"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>

<xsl:result-document method="xml" href="{$docpath}{$file.separator.esc}topic_refs{$f ile.separator.esc}{$topic_name_svc}.dita" doctype- system="topic.dtd" doctype-public="-//OASIS//DTD DITA Topic//EN" encoding="UTF-8"
indent="yes">
</xsl:result-document>
</xsl:template>
</xsl:transform>

Currently it's generating the seprate unique files for each service with the content in same execution of tool. The expected output is to have same names for each service accross different executions of the tool.
Note: There might be chances to edit the services. i.e new services may be added or deleted the services from the xml. Service position might not be constant.

Current results:
================
Execution 1:
Sales_Person_Setup-12345.xml Sales_Person_Setup-76589.xml
Execution 2:
Sales_Person_Setup-78321.xml Sales_Person_Setup-67598.xml

Expected results:
================
Execution 1:
Sales_Person_Setup-12345.xml Sales_Person_Setup-76589.xml
Execution 2:
Sales_Person_Setup-12345.xml Sales_Person_Setup-76589.xml
Reply With Quote