[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RE: description of the logical or semantic structure

  • To: Michael Kay <mike@s...>
  • Subject: Re: RE: description of the logical or semantic structure
  • From: Philippe Poulard <Philippe.Poulard@s...>
  • Date: Wed, 02 Nov 2005 17:23:48 +0100
  • Cc: "'ludger goeke'" <ludgergoeke@g...>, xml-dev@l...
  • In-reply-to: <200511021504.jA2F4jvZ004383@s...>
  • References: <200511021504.jA2F4jvZ004383@s...>
  • User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050511

xsl logical or
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    |
  -----------------------

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.