[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSl Import and double styles

Subject: Re: XSl Import and double styles
From: Ankit Jain <Ankit.Jain@xxxxxxxxxxx>
Date: Mon, 10 Mar 2003 15:52:36 +0100
jain import
Thanks for the help. But I really donot understand why this happens and how
to solve it. I have the following code copied from MSDN.

Books.xml
<?xml:stylesheet type="text/xsl" href="MSSample.xsl"?>
<catalog>
 <Annotation title="Testing Annotation" type="Interesting" author="jain"
comments="Another ONe" linkto="">
  <book id="bk102">
   <author>Ralls, Kim</author>
   <title>Midnight Rain</title>
   <genre>Fantasy</genre>
   <price>5.95<price1>5.95</price1></price>
   <Annotation title="whatsover" type="Important" author="jain"
comments="Good for me" linkto="">
    <publish_date>2000-12-16</publish_date>
   </Annotation>
   <description>A former architect battles corporate zombies,
         an evil sorceress, and her own childhood to become queen
         of the world.
         </description>
  </book>
 </Annotation>


 <book id="bk106">
  <Annotation type="interesting">
   <author>Randall, Cynthia</author>
  </Annotation>
  <title>Lover Birds</title>
  <genre>Romance</genre>
  <price>4.95</price>
  <publish_date>2000-09-02</publish_date>
  <description>When Carla meets Paul at an ornithology
      conference, tempers fly as feathers get ruffled.</description>
 </book>

</catalog>
------------------------
MSSample-import.xsl --->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<!-- Override built-in template. -->
<xsl:template match="text()"/>

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

<xsl:template match="book">
  <i>
    <xsl:apply-templates select="title"/>
  </i>
    <xsl:text> By: </xsl:text>
  <xsl:apply-templates select="author"/>
  <br/>
</xsl:template>

<xsl:template match="title">

  <b>
    <xsl:value-of select="."/>
  </b>

</xsl:template>

<xsl:template match="author">
  <font color="blue">
    <xsl:value-of select="."/>
  </font>
</xsl:template>

</xsl:stylesheet>
--------------------
MSSample.xsl --->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="MSsample-import.xsl"/>
<xsl:output method="html"/>

<xsl:template match="Annotation">
   <DIV style="background:Yellow">
   <font face="Arial" color="RED">
      <xsl:apply-imports/>
   </font>
   </DIV>
</xsl:template>

</xsl:stylesheet>
-----------------------

Now while displaying the file, only if the Annotation tag is the parent of
the book tag, then only the contents are displayed . Else if, the annotation
tag is made parent of (say.. <author> tag), then the contents of the tag
disappear; Why ?

Also, the font color of the font is not overrided to RED as per the
priority.. It is still shown as Blue for the author.

THanks and Regards
ANkit



Michael Kay a écrit :

> This is exactly what xsl:apply-imports does.
>
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.