OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] RE: description of the logical or semantic structure

[ Lists Home | Date Index | Thread Index ]
  • To: Michael Kay <mike@saxonica.com>
  • Subject: Re: [xml-dev] RE: description of the logical or semantic structure
  • From: Philippe Poulard <Philippe.Poulard@sophia.inria.fr>
  • Date: Wed, 02 Nov 2005 17:23:48 +0100
  • Cc: "'ludger goeke'" <ludgergoeke@gmx.de>, xml-dev@lists.xml.org
  • In-reply-to: <200511021504.jA2F4jvZ004383@sophia.inria.fr>
  • References: <200511021504.jA2F4jvZ004383@sophia.inria.fr>
  • User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050511

Michael Kay wrote:
>><Person>
>>   <Name>Peter Smith</Name>
>>   <Age>56</Age>
>></Person>
>>
>>
>>Does the markup describes  the content for example  "Peter Smith" in a
>>semantic way, that means does it describes that 
>>the content "Peter Smith" has the semantic of a name 
> 
> 
> No, the tags in your markup are arbitrary strings. It's your description of
> the markup "When I say Name, I mean personal name" that conveys the
> semantics. There's arguably a default description "When I use a tag that's
> an English word, I use it with the same meaning as that English word", but
> that's still something that's external to the XML document itself. The tags
> have no meaning without an external explanation of their intent and usage.
> Without that explanation, the above XML fragment could mean "Launch an
> attack on Cuba NOW!".
> 
> Michael Kay
> 

there exists an application that does it exactly like this :)

------------- secret-message.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="decoder.xsl"?>
<Person>
     <Name>Peter Smith</Name>
     <Age>56</Age>
</Person>

------------- decoder.xsl :
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     xmlns:cn="http://my.ennemies.com";
     xmlns:date="http://www.dates.org";
 >
     <cn:ennemies>
         <cn:ennemy>North Korea</cn:ennemy>
         <cn:ennemy>France</cn:ennemy>
         <cn:ennemy>Irak</cn:ennemy>
         <cn:ennemy>Iran</cn:ennemy>
         <cn:ennemy>Cuba</cn:ennemy>
     </cn:ennemies>
     <date:dates>
         <date:when>Tomorrow</date:when>
         <date:when>Next monday</date:when>
         <date:when>At christmas</date:when>
         <date:when>The next 14th of july</date:when>
         <date:when>Yesterday ?</date:when>
         <date:when>NOW!</date:when>
     </date:dates>

     <xsl:strip-space elements="*"/>

     <xsl:template match="/">
         <html>
             <body>
                 <h1><xsl:apply-templates/></h1>
             </body>
         </html>
     </xsl:template>

     <xsl:template match="*">
         <xsl:variable name="alternate">
             <xsl:choose>
                 <xsl:when test="contains( name(), 'm' )"><xsl:text> 
</xsl:text></xsl:when>
                 <xsl:otherwise>a</xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:value-of select="translate( name(), 'emnNoPrs', concat( 
$alternate, 'nh cLun' ) )"/>
         <xsl:apply-templates/>
     </xsl:template>

     <xsl:template match="Age">
         <xsl:value-of 
select="document('')/*/cn:ennemies/cn:ennemy[number(substring(current(),1,1))]"/>
         <xsl:text> </xsl:text>
         <xsl:value-of 
select="document('')/*/date:dates/date:when[number(substring(current(),2,1))]"/>
     </xsl:template>

     <xsl:template match="text()">
         <xsl:variable name="alternate">
             <xsl:value-of select="translate( ., ' eimPrS', 'kanoac ' )"/>
         </xsl:variable>
             <xsl:choose>
                 <xsl:when test="substring( $alternate, 2, 1) = 'a'">
                     <xsl:value-of select="substring( $alternate, 1, 1)"/>
                     <xsl:text>t</xsl:text>
                     <xsl:value-of select="substring( $alternate, 3, 7)"/>
                     <xsl:text> </xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
                     <xsl:value-of select="$alternate"/>
                 </xsl:otherwise>
             </xsl:choose>
     </xsl:template>

</xsl:stylesheet>

-- 
Cordialement,

            ///
           (. .)
  -----ooO--(_)--Ooo-----
|   Philippe Poulard    |
  -----------------------




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS