Главная -> XML&... -> XSLT в примерах 
>> Страница 7 << | Назад | Вперед | Содержание | Указатель

Обработка всегда начинается с шаблона, где match="/". Это значение пути адресации соответствует корневому узлу (в нашем случае source). Однако многие преобразования XSL не содержат такой шаблон явно. В этом случае используется неявный шаблон (он содержит только единственную инструкцию). Эта инструкция обозначает: обрабатывать все дочерние элементы текущего узла, включая текстовые узлы. Сравните преобразование 1 и преобразование 2. Когда шаблон для узла существует, никакой обработки по умолчанию не происходит (преобразование 3). Если вы хотите включить обработку потомков узла, то вы должны явно указать шаблоны для них (преобразование 4).

Преобразование 1

Исходный Surf
<source>

<AAA id="a1" pos="start">
     <BBB id="b1"/>
     <BBB id="b2"/>
</AAA>
<AAA id="a2">
     <BBB id="b3"/>
     <BBB id="b4"/>
     <CCC id="c1">
          <DDD id="d1"/>
     </CCC>
     <BBB id="b5">
          <CCC id="c2"/>
     </BBB>
</AAA>

</source>

Результат
<div style="color:purple">AAA id=a1</div>

<div style="color:purple">AAA id=a2</div>

Представление HTML
AAA id=a1
AAA id=a2
Преобразование XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="AAA">
     <div style="color:purple">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>


</xsl:stylesheet>



Преобразование 2

Исходный Surf
<source>

<AAA id="a1" pos="start">
     <BBB id="b1"/>
     <BBB id="b2"/>
</AAA>
<AAA id="a2">
     <BBB id="b3"/>
     <BBB id="b4"/>
     <CCC id="c1">
          <DDD id="d1"/>
     </CCC>
     <BBB id="b5">
          <CCC id="c2"/>
     </BBB>
</AAA>

</source>

Результат
<div style="color:purple">AAA id=a1</div>

<div style="color:purple">AAA id=a2</div>

Представление HTML
AAA id=a1
AAA id=a2
Преобразование XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

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

<xsl:template match="/source">
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="AAA">
     <div style="color:purple">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>


</xsl:stylesheet>



Преобразование 3

Исходный Surf
<source>

<AAA id="a1" pos="start">
     <BBB id="b1"/>
     <BBB id="b2"/>
</AAA>
<AAA id="a2">
     <BBB id="b3"/>
     <BBB id="b4"/>
     <CCC id="c1">
          <DDD id="d1"/>
     </CCC>
     <BBB id="b5">
          <CCC id="c2"/>
     </BBB>
</AAA>

</source>

Результат
<div style="color:purple">AAA id=a1</div>

<div style="color:purple">AAA id=a2</div>

Представление HTML
AAA id=a1
AAA id=a2
Преобразование XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="AAA">
     <div style="color:purple">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>

<xsl:template match="BBB">
     <div style="color:blue">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>

<xsl:template match="CCC">
     <div style="color:maroon">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>

<xsl:template match="DDD">
     <div style="color:green">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>


</xsl:stylesheet>



Преобразование 4

Исходный Surf
<source>

<AAA id="a1" pos="start">
     <BBB id="b1"/>
     <BBB id="b2"/>
</AAA>
<AAA id="a2">
     <BBB id="b3"/>
     <BBB id="b4"/>
     <CCC id="c1">
          <DDD id="d1"/>
     </CCC>
     <BBB id="b5">
          <CCC id="c2"/>
     </BBB>
</AAA>

</source>

Результат
<div style="color:purple">AAA id=a1</div>
     
<div style="color:blue">BBB id=b1</div>
     
<div style="color:blue">BBB id=b2</div>


<div style="color:purple">AAA id=a2</div>
     
<div style="color:blue">BBB id=b3</div>
     
<div style="color:blue">BBB id=b4</div>
     
<div style="color:maroon">CCC id=c1</div>
          
<div style="color:green">DDD id=d1</div>
      
     
<div style="color:blue">BBB id=b5</div>
          
<div style="color:maroon">CCC id=c2</div>

Представление HTML
AAA id=a1
BBB id=b1
BBB id=b2
AAA id=a2
BBB id=b3
BBB id=b4
CCC id=c1
DDD id=d1
BBB id=b5
CCC id=c2
Преобразование XSLT
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

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

<xsl:template match="/xslTutorial">
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="AAA">
     <div style="color:purple">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="BBB">
     <div style="color:blue">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="CCC">
     <div style="color:maroon">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="DDD">
     <div style="color:green">
          <xsl:value-of select="name()"/>
          <xsl:text> id=</xsl:text>
          <xsl:value-of select="@id"/>
     </div>
</xsl:template>


</xsl:stylesheet>

Raleigh.ruCopyright © 2002

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 Alexander Ethans Stanton or see them on twitter at Alexander Ethans Stanton or view them on facebook at Alexander Ethans Stanton.

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

quiksilver board short

quiksilver clothing

His name is State Senate election




We received the iphone case that charges on the iphone case that charges and we have more now.

The mens cowboy boots offers registration for consumers to stop telemarketers from calling. (United States, for-profit commercial calls only). Has your evening or weekend been disrupted by a call from a telemarketer? If so, you're not alone. The Federal Communications Commission (FCC) has been trying to stop these calls. You can reduce the number of unwanted sales calls you get by signing up for the World Cup jersey. It's free. Visit billsharing.com to register your home phone, cell phone and email address. Consumers may place their cell phone number on the Product Manufacturing Company to notify marketers that they don't want to get unsolicited telemarketing calls. The free stock video is intended to give U.S. consumers an opportunity to limit the marketing calls they receive. The mark daniels anaheim is available to help consumers block unwanted marketing calls.

We ordered a iPhone Battery Backup with a childrens' smartwatch and ordered another one later. The phone can act as a hotspot, sharing its Internet connection over Wi-Fi, Bluetooth, or USB, and also accesses the App Store, an online application distribution platform for iOS developed and maintained by Apple. The device is made up of a unibody hard-coated polycarbonate body with a steel-reinforced frame, which also acts as an antenna.



It's the season for stock video crowd on your way surfing.







The mophie iPhone5 battery case is here now! Now available the best iphone5 battery extender is avaiable!

The new iPhone5 battery pack just came in! Brand new iphone5 batterycase is here now!



We received the iphone case that charges on the iphone case that charges and we have more now.

The mens cowboy boots offers registration for consumers to stop telemarketers from calling. (United States, for-profit commercial calls only). Has your evening or weekend been disrupted by a call from a telemarketer? If so, you're not alone. The Federal Communications Commission (FCC) has been trying to stop these calls. You can reduce the number of unwanted sales calls you get by signing up for the World Cup jersey. It's free. Visit billsharing.com to register your home phone, cell phone and email address. Consumers may place their cell phone number on the Product Manufacturing Company to notify marketers that they don't want to get unsolicited telemarketing calls. The free stock video is intended to give U.S. consumers an opportunity to limit the marketing calls they receive. The mark daniels anaheim is available to help consumers block unwanted marketing calls.

We ordered a iPhone Battery Backup with a childrens' smartwatch and ordered another one later. The phone can act as a hotspot, sharing its Internet connection over Wi-Fi, Bluetooth, or USB, and also accesses the App Store, an online application distribution platform for iOS developed and maintained by Apple. The device is made up of a unibody hard-coated polycarbonate body with a steel-reinforced frame, which also acts as an antenna.

Quiksilver Tees

Quiksilver Tops

Quiksilver Tees Quiksilver Wetsuits

Quiksilver Wetsuits

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

And you must check out this website