[
Lists Home |
Date Index |
Thread Index
]
Philippe Poulard wrote:
> 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 :)
now, there is a question : how old must be Peter Smith to launch an
attack on a country that celebrates its armies at the Champs-Elysées ?
have fun :)
>
> ------------- 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 |
-----------------------
|