Saturday, 1. October 2005
PermaLinkTransforming DXL to a record/field structure.
Written By : Stephan H. WisselCategory : XML
Location : Singapore

Gary is updating his samples to Domino 6.x. One challenge he encountered is how to transform DXL to something that looks more like a record. In LotusScript you chain a NotesDXLExporter with a NotesXSLTransformer and apply a stylesheet. Here it gets a little tricky. Since Notes knows multi-values you are never too sure what you will get. Also there is MIME and RichText. Excluding these two, the following stylesheet does the trick (might be incomplete):

<?xml version="1.0" encoding="UTF-8"?>

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

   xmlns:d="http://www.lotus.com/dxl">

   <xsl:template match="/">

       <records>

           <xsl:apply-templates select="//d:document"/>

       </records>

   </xsl:template>

   <xsl:template match="d:document">

       <xsl:element name="record">

           <xsl:attribute name="form">

               <xsl:value-of select="@form"/>

           </xsl:attribute>

           <xsl:attribute name="unid">

               <xsl:value-of select="d:noteinfo/@unid"/>

           </xsl:attribute>

           <xsl:apply-templates select="d:item"/>

       </xsl:element>

   </xsl:template>

   <xsl:template match="d:item">

       <xsl:element name="field">

           <xsl:attribute name="name">

               <xsl:value-of select="@name"/>

           </xsl:attribute>

           <!-- here comes the tricky part - get the field type and the values -->

           <xsl:attribute name="type">

               <xsl:value-of select="name(child::*[1])" />

           </xsl:attribute>

           <xsl:apply-templates />

       </xsl:element>

   </xsl:template>

   <!-- Process the various data types -->

   <xsl:template match="d:textlist">

       <xsl:apply-templates select="d:text"/>

   </xsl:template>

   <xsl:template match="d:text[position()=1]"><xsl:value-of select="."/></xsl:template>

   <!-- We use ; separators for multivalues -->

   <xsl:template match="d:text[position()!=1]">; <xsl:value-of select="."/></xsl:template>

   <xsl:template match="d:datetimelist">

       <xsl:apply-templates select=".//d:datetime"/>

   </xsl:template>

   <xsl:template match="d:datetime[position()=1]"><xsl:value-of select="."/></xsl:template>

   <!-- We use ; separators for multivalues -->

   <xsl:template match="d:datetime[position()!=1]">; <xsl:value-of select="."/></xsl:template>

   <xsl:template match="d:numberlist">

       <xsl:apply-templates select="d:number"/>

   </xsl:template>

   <xsl:template match="d:number[position()=1]"><xsl:value-of select="."/></xsl:template>

   <!-- We use ; separators for multivalues -->

   <xsl:template match="d:number[position()!=1]">; <xsl:value-of select="."/></xsl:template>

   <!-- exclude rawitemdata for now, we are only interested in native fields -->

   <xsl:template match="d:item[d:rawitemdata]" />

</xsl:stylesheet>


(Get it in the download section)
Comments :v

No documents found

Enter Comments^



Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:angry: :-( :-p :lips: :laugh: :-o :rolleyes: :huh: :-D :grin: :cool: :cry: :-) :-\ ;-) :-x :emb:
bold italic underline Strikethrough





Remember me    

Site purpose and disclaimer
You consider to extend or replace your Domino infrastructure. You found a lot of information about messaging migration. You didn't find much about the applications, other than tool vendors advertisements. You realized that Domino migration is an emotional mine field. Bookmark this site, we will provide information and discuss the move from Domino to J2EE and other environments (both retaining and replacing Domino). We focus on applications, not on messaging.

The articles on this site mention products and phrases, that might be subject to copyright or trademarks. So we acknowledge, that the copyrights belong to the owner of the respective copyright or trademark.The links on this page are provided for convenience and are constitute no endorsement of the content of the target site.

So once your ready to discuss if and/or how to move away from Domino contact us.
Search
Site Contributors
Related Links
Resources
Some of the articles come with sample code or documents. You can get them in the Downloads section. Please check for the copyright accompanying the files.
Unless mentioned otherwise copyright of all of this site content is subject to a creative commons licence.
By Category
Lotus Domino ND7 RSS News Feed RSS Validator OpenNTF BlogSphere
Monthly Archive
Ads by Google