OpenCDS Devices profiles transformation

I have used XSLT as a transformation engine to transform the Devices profiles from the manufacture form to the OpenCDS form.

Handsets Profiles Links:

A few Notes on the Following XSLT:
some MIME Types are not found in OpenCDS so I maped it to temp directory with .tmp extension, so you should create this Content Type (temp) and attach to it all MIME TYPEs that doesn't exist in the system

the following is Nokia XSL that is used to transform from Nokia format to OpenCDS format:

Code:
<xsl:stylesheet version="2.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
     xmlns:xlink="http://www.w3.org/1999/xlink" 
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"  
     xmlns:UML="org.omg.xmi.namespace.UML"  
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     xmlns:prf="http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"  
     xmlns:mms="http://www.wapforum.org/profiles/MMS/ccppschema-20010111#" 
     exclude-result-prefixes="xs xdt UML rdf prf mms"> 

<xsl:output method="text" media-type="text/xml" indent="yes" encoding="ISO-8859-1" /> 
<xsl:template match="rdf:RDF/rdf:Description"><![CDATA[<Handset>]]> 
	<xsl:apply-templates select="prf:component" /><![CDATA[</Handset>]]> 
</xsl:template> 

<!--xsl:for-each select="prf:component"> 
 <xsl:apply-templates select="rdf:Description" /> 
</xsl:for-each--> 
  
<xsl:template match="Description"><![CDATA[<ID>]]><xsl:value-of select="@ID"  /><![CDATA[</ID>]]> 
  <![CDATA[<Name>]]><xsl:value-of select="Name" /><![CDATA[</Name>]]> 
</xsl:template> 
  
<xsl:template match="prf:component"> 
  <xsl:if test="rdf:Description/@rdf:ID = 'HardwarePlatform'">  <![CDATA[<Name>]]><xsl:value-of select="rdf:Description/prf:Vendor" />_<xsl:value-of select="rdf:Description/prf:Model"  /><![CDATA[</Name>]]> 
  <![CDATA[<Model>]]><xsl:value-of select="rdf:Description/prf:Model"/><![CDATA[</Model>]]> 
   
  <![CDATA[<Manufacturer>]]><xsl:value-of select="rdf:Description/prf:Vendor" /><![CDATA[</Manufacturer>]]> 
  
  <![CDATA[<Description>Sample ]]><xsl:value-of select="rdf:Description/prf:Vendor" /><![CDATA[device</Description>]]> 
  
  <![CDATA[<UserAgentPattern>.*]]><xsl:value-of select="rdf:Description/prf:Vendor"/><xsl:value-of select="rdf:Description/prf:Model"/><![CDATA[.*</UserAgentPattern>]]>
</xsl:if> 

<xsl:if test="rdf:Description/@rdf:ID = 'MmsCharacteristics'"> 
   <!--xsl:variable name="allMMSMimeTypes" select="rdf:Description/mms:MmsCcppAccept/rdf:Bag/rdf:li" as="xs:string" /> 
   
   <![CDATA[<ALL_MMS>]]><xsl:value-of select="rdf:Description/mms:MmsCcppAccept/rdf:Bag/rdf:li"  
  
  
/><![CDATA[</ALL_MMS>]]-->  

</xsl:if> 
   
<xsl:if test="rdf:Description/@rdf:ID = 'SoftwarePlatform'"> 
  
  <![CDATA[<MimeTypes>]]> 
  
  <xsl:for-each select="rdf:Description/prf:CcppAccept/rdf:Bag/rdf:li"> 
  
    <xsl:variable name="mimeType" select="." as="xs:string" /> 
  
    <![CDATA[<MimeType>]]> 
        <![CDATA[<MimeName>]]><xsl:if test="substring-before($mimeType,' ') = ''"><xsl:value-of select="$mimeType"/></xsl:if><xsl:if test="substring-before($mimeType,' ') !=  ''"><xsl:value-of select="substring-before($mimeType,' ')"/></xsl:if><![CDATA[</MimeName>]]> 
        <!-- ========================================================================================  
             ======================================================================================== --> 
        <xsl:choose> 
          <!-- if MIME Type audio/midi --> 
          <xsl:when test="$mimeType = 'audio/midi'"><![CDATA[<MimeContentType>ringtone</MimeContentType> 
        <Extension>.mid</Extension> 
        <DeliveryType>1</DeliveryType>]]> 
          </xsl:when> 
  
        <!-- if MIME Type image/gif --> 
  
        <xsl:when test="$mimeType = 'image/gif'"><![CDATA[<MimeContentType>image</MimeContentType> 
          <Extension>.gif</Extension> 
          <DeliveryType>1</DeliveryType>]]> 
        </xsl:when> 
  
        <!-- if MIME Type image/jpeg --> 
        <xsl:when test="$mimeType = 'image/jpeg'"><![CDATA[<MimeContentType>image</MimeContentType> 
  <Extension>.jpg</Extension> 
  
  

      <DeliveryType>1</DeliveryType>]]> 
  
  

        </xsl:when> 
  
  

  

        <!-- if MIME Type image/png --> 
  
  

        <xsl:when test="$mimeType = 
  
  
 'image/png'"><![CDATA[<MimeContentType>image</MimeContentType> 
  
  

      <Extension>.png</Extension> 
  
  

      <DeliveryType>1</DeliveryType>]]> 
  
  

        </xsl:when> 
        <!-- if MIME Type audio/imelody -->
        <xsl:when test="$mimeType = 'audio/imelody'"><![CDATA[<MimeContentType>ringtone</MimeContentType> 
          <Extension>.imy</Extension> 
          <DeliveryType>1</DeliveryType>]]> 
        </xsl:when> 
  
      <!-- if MIME Type application/java-archive --> 
      <xsl:when test="$mimeType = 'application/java-archive'"><![CDATA[<MimeContentType>midlet</MimeContentType> 
  	<Extension>.jar</Extension> 
  	<DeliveryType>2</DeliveryType>]]> 
      </xsl:when> 

      <!-- if MIME Type image/vnd.wap.wbmp --> 
  
  

	<xsl:when test="$mimeType = 
  
  
 'image/vnd.wap.wbmp'"><![CDATA[<MimeContentType>image</MimeContentType> 
  
  

      <Extension>.wbmp</Extension> 
  
  

      <DeliveryType>1</DeliveryType>]]> 
  
  

	</xsl:when> 
  
  

  

	<!-- if MIME Type text/vnd.sun.j2me.app-descriptor --> 
  
  

	<xsl:when test="$mimeType = 
  
  
 'text/vnd.sun.j2me.app-descriptor'"><![CDATA[<MimeContentType>midlet</MimeContentType> 
  
  

      <Extension>.jad</Extension> 
  
  

      <DeliveryType>2</DeliveryType>]]> 
  
  

	</xsl:when> 
  
  

	<xsl:otherwise><![CDATA[<MimeContentType>temp</MimeContentType> 
  
  

      <Extension>.tmp</Extension> 
  
  

      <DeliveryType>1</DeliveryType>]]> 
  
  

      </xsl:otherwise> 
  
  

     </xsl:choose> 
  
  

  

  

      <xsl:variable name="isMMSCapable" select="0"/> 
  
  

      <xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/mms:MmsCcppAccept/rdf:Bag/rdf:li"> 
  
  

        <xsl:if test="$mimeType = ."><![CDATA[<IsMMSCapable>yes</IsMMSCapable>]]> 
  
  

          <!--xsl:variable name="isMMSCapable" select="true" as="xs:boolean" /--> 
  
  

	  <!--xsl:variable name="isMMSCapable" select="$isMMSCapable+1" /> 
  
  

	  	  isMMSCapable = <xsl:value-of select="$isMMSCapable" /--> 
  
  

        </xsl:if> 
  
  

      </xsl:for-each> 
  
  

      <!-- To be removed --> 
  
  

      <![CDATA[<IsMMSCapable>no</IsMMSCapable>]]> 
  
  

      <!-- End of remove--> 
  
  

      <xsl:if test="$isMMSCapable = 101"><![CDATA[<IsMMSCapable>no</IsMMSCapable>]]> 
  
  

      </xsl:if> 
  
  

    <![CDATA[</MimeType>]]> 
  
  

  </xsl:for-each> 
  
  

  <![CDATA[</MimeTypes>]]> 
  
  

  

  <![CDATA[<Capabilities>]]> 
  
  

    <xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:JavaPlatform/rdf:Bag/rdf:li"> 
  
  

    <xsl:variable name="supportedlibs" select="substring-before(.,'-')"/> 
  
  

    <xsl:if test="$supportedlibs = 'MIDP/1.0'"> 
  
  

    <![CDATA[<Capability> 
  
  

       <Name>supportedlibs</Name> 
  
  

       <Value>]]><xsl:value-of select="substring-before($supportedlibs,'/')"/>-<xsl:value-of  
  
  
select="substring-after($supportedlibs,'/')"/><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

    </xsl:if> 
  
  

    </xsl:for-each> 
  
  

  

    <xsl:for-each  
  
  
select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:XhtmlModules/rdf:Bag/rdf:li"> 
  
  

    <![CDATA[<Capability> 
  
  

       <Name>browsertype</Name> 
  
  

       <Value>]]><xsl:value-of select="."/><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

    </xsl:for-each> 
  
  

  

  <![CDATA[<Capability> 
  
  

       <Name>bitsperpixel</Name> 
  
  

       <Value>]]><xsl:value-of 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:BitsPerPixel"/><![CDATA[</Value&g 
  
  
t;
    </Capability>]]> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>]]>inputcharset<![CDATA[</Name> 
  
  

       <Value>]]><xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:InputCharSet/rdf:Bag/rdf:li"><xsl:va 
  
  
lue-of select="."/>|</xsl:for-each><![CDATA[</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>]]>outputcharset<![CDATA[</Name> 
  
  

       <Value>]]><xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:OutputCharSet/rdf:Bag/rdf:li"><xsl:v 
  
  
alue-of select="."/>|</xsl:for-each><![CDATA[</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>]]>screenheight<![CDATA[</Name> 
  
  

       <Value>]]><xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:ScreenSize"><xsl:value-of  
  
  
select="substring-before(.,'x')"/>	</xsl:for-each><![CDATA[</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>]]>screenwidth<![CDATA[</Name> 
  
  

       <Value>]]><xsl:for-each 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:ScreenSize"><xsl:value-of  
  
  
select="substring-after(.,'x')"/></xsl:for-each><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>configuration</Name> 
  
  

       <Value>]]><xsl:for-each  
  
  
select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:JavaPlatform/rdf:Bag/rdf:li"><xs 
  
  
l:if test="substring-before(.,'/') = 'Configuration'"><xsl:value-of  
  
  
select="substring-after(.,'/')"/>|</xsl:if></xsl:for-each><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

  

    <xsl:for-each  
  
  
select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:JavaPlatform/rdf:Bag/rdf:li"> 
  
  

    <xsl:if test="substring-before(.,'/') = 'Profile'"> 
  
  

    <![CDATA[<Capability> 
  
  

       <Name>profile</Name> 
  
  

       <Value>]]><xsl:value-of select="substring-after(.,'/')"/><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

    </xsl:if> 
  
  

    </xsl:for-each> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>colorcapable</Name> 
  
  

       <Value>]]><xsl:value-of 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:ColorCapable"/><![CDATA[</Value&g 
  
  
t;
    </Capability>]]> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>imagecapable</Name> 
  
  

       <Value>]]><xsl:value-of  
  
  
select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:ImageCapable"/><![CDATA[</Val ue> 
  
  

    </Capability>]]> 
  
  

  

    <xsl:variable name="language"  
  
  
select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:CcppAccept-Language/rdf:Seq"/> 
  
  

    <xsl:if test="$language != ''"> 
  
  

    <![CDATA[<Capability> 
  
  

       <Name>ccppaccept-language</Name> 
  
  

       <Value>]]><xsl:value-of select="substring-before($language,'-')"/>_<xsl:value-of  
  
  
select="substring-after($language,'-')"/><![CDATA[</Value> 
  
  

    </Capability>]]> 
  
  

    </xsl:if> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>numberofsoftkeys</Name> 
  
  

       <Value>]]><xsl:value-of 
  
  
 select="/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:NumberOfSoftKeys"/><![CDATA[</Val ue> 
  
  

    </Capability>]]> 
  
  

  

    <![CDATA[<Capability> 
  
  

       <Name>confirmcapable</Name> 
  
  

       <Value>no</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>maxappsize</Name> 
  
  

       <Value>*</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>maxcntsize</Name> 
  
  

       <Value>*</Value> 
  
  

    </Capability> 
  
  

  

    <Capability> 
  
  

       <Name>descriptor-template</Name> 
  
  

       <Value>General Content Descriptor</Value> 
  
  

    </Capability> 
  
  

  </Capabilities>]]> 
  
  

</xsl:if> 
  
  

</xsl:template> 
  
  

  

<xsl:template match="rdf:Description"> 
  
  

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

</xsl:template> 
  
  

  

</xsl:stylesheet> 
  

Amazing Article.. Thanks for

Nice sharing. Using the

Nice sharing. Using the application, I did get a good result then. - Flemings Ultimate Garage

naruto

Sebagai perkembangan zaman dan saat ini teknologi yang terus berkembang, Cantik itu sehat
banyak contoh modifikasi yang muncul dan kita dapat menemukan contoh modifikasi Blog Harga Motor Fz16 dari sumber-sumber
rujukan berbeda media massa serta sebagai online.baca blog kami
Manfaat dari kacang yang paling fenomenal dalam dunia
kesehatan adalah Selengkapnya baca di sini Perannya dalam membentuk jantung sehat.
pakai Blog Harga Mobil Sayuran ini menjadi salah satu jenis sayuran yang mudah kita temukan di
mana-mana, hampir setiap pedagang kuharga sayuran menjualnya. Banyak kuliner Indonesia
yang menggunakan kacang sebagai salah satu bahan yang digunakan.tentunnya www.bloghargahape.blogspot.com

Powered by Drupal - Design by artinet