XML/XSLT stylesheet/unparsed entity uri — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 11:26, 26 мая 2010

unparsed-entity-uri()

   <source lang="xml">

File: Data.xml

<poem>

 <verse>line 1</verse>
 <verse>line 2</verse>
 <picture picfile="squadron" />
 <verse>line 3</verse>
 <verse>line 4</verse>
 <verse>line 5</verse>
 <picture picfile="ceres" />

</poem> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 version="1.0">
 <xsl:output method="html" />
 <xsl:template match="poem">
   <html>
     <body>
       <xsl:apply-templates />
     </body>
   </html>
 </xsl:template>
 <xsl:template match="verse">

<xsl:apply-templates />

 </xsl:template>
 <xsl:template match="picture">
   <img src="{unparsed-entity-uri(@picfile)}" />
 </xsl:template>

</xsl:stylesheet> Output: <html>

  <body>
       

line 1

line 2

       <img src="">
       

line 3

line 4

line 5

       <img src="">
     
  </body>

</html>

</source>