English | Français | >> Deutsch << | Magyar | 中文 | Polski adultinternetusers > Tutorials > XSLT Tutorial
>> Seite 25 << | Zurück | Vor | Inhalt | Element-Index

Das "xsl:copy" Element kann ein "use-attribute-sets"-Attribut besitzen. Auf diese Weise k?nnen bestimmte Attribute für die Kopie spezifiziert werden. XSLT Stylesheet 2 arbeitet nicht wie erwartet (Die Zuordnung innerhalb eines "use-attributes-sets" zu einer benamten Funktion), da Ausdrücke in Attributen, die auf ein benamtes XSLT-Objekt zeigen nicht evaluiert werden.

XSLT Stylesheet 1

XML Quelltext
<source>

<h1>GREETING</h1>
<p>Hello, world!</p>

</source>

Ausgabe
<h1 align="center" style="color:red">GREETING</h1>
<p align="left" style="color:blue">Hello, world!</p>

HTML-Ansicht

GREETING

Hello, world!

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

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

<xsl:template match="h1">
     <xsl:copy use-attribute-sets="H1">
          <xsl:value-of select="."/>
     </xsl:copy>
</xsl:template>

<xsl:template match="p">
     <xsl:copy use-attribute-sets="P ">
          <xsl:value-of select="."/>
     </xsl:copy>
</xsl:template>

<xsl:attribute-set name="H1">
     <xsl:attribute name="align">center</xsl:attribute>
     <xsl:attribute name="style">color:red</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="P">
     <xsl:attribute name="align">left</xsl:attribute>
     <xsl:attribute name="style">color:blue</xsl:attribute>
</xsl:attribute-set>

</xsl:stylesheet>



XSLT Stylesheet 2

XML Quelltext
<source>

<h1>GREETING</h1>
<p>Hello, world!</p>

</source>

Ausgabe
Failed to compile stylesheet. 1 error detected.
javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:136)
at com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:127)
at Main$TransformerThread.transform(Main.java:105)
at Main$TransformerThread.run(Main.java:80)
at java.lang.Thread.run(Thread.java:595)

HTML-Ansicht
Failed to compile stylesheet. 1 error detected. javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:136) at com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:127) at Main$TransformerThread.transform(Main.java:105) at Main$TransformerThread.run(Main.java:80) at java.lang.Thread.run(Thread.java:595)
XSLT Stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

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

<xsl:template match="*">
     <xsl:copy use-attribute-sets="{name(.)}">
          <xsl:value-of select="."/>
     </xsl:copy>
</xsl:template>

<xsl:attribute-set name="H1">
     <xsl:attribute name="align">center</xsl:attribute>
     <xsl:attribute name="style">color:red</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="P">
     <xsl:attribute name="align">left</xsl:attribute>
     <xsl:attribute name="style">color:blue</xsl:attribute>
</xsl:attribute-set>

</xsl:stylesheet>


Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers

City Of Stanton | City Of Stanton | Warren Stanton Council and Gary Taylor Stanton | City Of Stanton |



Take a moment to visit 1cecilia438 or see them on twitter at 1cecilia410 or view them on facebook at hawaiian luxury shoes.

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

Don't forget to check out the following links. You'll be glad you did:

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