English | >> Français << | Deutsch | Magyar | 中文 | Polski adultinternetusers > Tutorials > XSLT Tutorial
>> Page 55 << | Précédent | Suivant | Contenu | Index des éléments

La fonction id() sélectionne les éléments sur la base de l'identifiant unique qui leur est associé. Feuille de style XSLT 1 montre des exemples simples d'utilisation de cette fonction. Examinez attentivement la feuille de style Feuille de style XSLT 2. Le contenu de l'élément title n'est pas affiché entre crochets "[]", car, dans la DTD, son attribut id est défini comme CDATA, et non pas comme ID. Plusieurs identifiants ID peuvent être fournis à la fois ( Feuille de style XSLT 3 ).

Feuille de style XSLT 1

Source Surf
<!DOCTYPE source [ 

<!ELEMENT chapter ANY>
<!ATTLIST chapter id ID #REQUIRED>
<!ELEMENT title ANY>
<!ATTLIST title id CDATA #REQUIRED>
<!ELEMENT text ANY>
<!ATTLIST text value ID #REQUIRED>

]>
<source>

<chapter id="intro">Introduction</chapter>
<chapter id="body">
     <title id="t1">BODY</title>
     <text value="text1">text text text</text>
</chapter>
<chapter id="end">THE END</chapter>

</source>

Sortie
<P>Introduction</P>
<P>text text text</P>
<P>text text text</P>

Vue HTML

Introduction

text text text

text text text

Feuille de style XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <P>
          <xsl:value-of select="id('intro')"/>
     </P>
     <P>
          <xsl:value-of select="id('body')/text"/>
     </P>
     <P>
          <xsl:value-of select="id('text1')"/>
     </P>
</xsl:template>


</xsl:stylesheet>



Feuille de style XSLT 2

Source Surf
<!DOCTYPE source [ 

<!ELEMENT chapter ANY>
<!ATTLIST chapter id ID #REQUIRED>
<!ELEMENT title ANY>
<!ATTLIST title id CDATA #REQUIRED>
<!ELEMENT text ANY>
<!ATTLIST text value ID #REQUIRED>

]>
<source>

<chapter id="intro">Introduction</chapter>
<chapter id="body">
     <title id="t1">BODY</title>
     <text value="text1">text text text</text>
</chapter>
<chapter id="end">THE END</chapter>

</source>

Sortie
<DIV>chapter : id = intro [ Introduction]</DIV>
<DIV>chapter : id = body [
BODY
text text text
]</DIV>
<DIV>title : id = t1 [ ]</DIV>
<DIV>text : value = text1 [ text text text]</DIV>
<DIV>chapter : id = end [ THE END]</DIV>

Vue HTML
chapter : id = intro [ Introduction]
chapter : id = body [ BODY text text text ]
title : id = t1 [ ]
text : value = text1 [ text text text]
chapter : id = end [ THE END]
Feuille de style XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <xsl:for-each select="//*[@*]">
          <DIV>
               <xsl:value-of select="name()"/>
               <xsl:text> : </xsl:text>
               <xsl:apply-templates select="@*"/>
          </DIV>
     </xsl:for-each>
</xsl:template>

<xsl:template match="@*">
     <xsl:value-of select="name()"/>
     <xsl:text> = </xsl:text>
     <xsl:value-of select="."/>
     <xsl:text> [ </xsl:text>
     <xsl:value-of select="id(.)"/>
     <xsl:text>]</xsl:text>
</xsl:template>


</xsl:stylesheet>



Feuille de style XSLT 3

Source Surf
<!DOCTYPE source [ 

<!ELEMENT chapter ANY>
<!ATTLIST chapter id ID #REQUIRED>
<!ELEMENT title ANY>
<!ATTLIST title id CDATA #REQUIRED>
<!ELEMENT text ANY>
<!ATTLIST text value ID #REQUIRED>

]>
<source>

<chapter id="intro">Introduction</chapter>
<chapter id="body">
     <title id="t1">BODY</title>
     <text value="text1">text text text</text>
</chapter>
<chapter id="end">THE END</chapter>

</source>

Sortie
<P style="color:red">Introduction</P>
<P style="color:red">
BODY
text text text
</P>
<P style="color:red">THE END</P>
<P>Introduction</P>
<P>Introduction</P>
<P>THE END</P>

Vue HTML

Introduction

BODY text text text

THE END

Introduction

Introduction

THE END

Feuille de style XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <xsl:apply-templates select="id('intro body end')"/>
     <P>
          <xsl:value-of select="id('intro body end')"/>
     </P>
     <P>
          <xsl:value-of select="id('body end intro')"/>
     </P>
     <P>
          <xsl:value-of select="id('in bod end')"/>
     </P>
</xsl:template>

<xsl:template match="*">
     <P style="color:red">
          <xsl:value-of select="."/>
     </P>
</xsl:template>


</xsl:stylesheet>


Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton
Internetusers
This is the website that has all the latest for surf, skate and snow. You can also see it here:. You'll be glad you saw the surf apparel.

Take a moment to visit 1cecilia448 or see them on twitter at 1cecilia448 or view them on facebook at 1cecilia448.

You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks