Re: [xsl] use two consecutive transformation in XSL

Subject: Re: [xsl] use two consecutive transformation in XSL
From: drkm <darkman_spam@xxxxxxxx>
Date: Tue, 6 Dec 2005 12:19:40 +0100 (CET)
"mus47@xxxxxxxx" wrote:

> > I guess the "<>xsl:copy>" is a typo in your email.
> > What are exactly the symptoms? Can you post a
> > minimal stylesheet / input document that
> > reproduce de problem?

>  <?xml version="1.0" encoding="utf-8"?>
> <?xml-stylesheet type="text/css" href="mystyle.xsl"?>
> <html  xmlns="http://www.w3.org/1999/xhtml";;>
                                            ^^^
> <body>
> <strong>
> abcd
> </strong>
> <i>
> abcd
> </i>
> <body>
  ^^^
> </html>

> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";;>
                                                 ^^^
> <xsl:template match="strong">
> <strong>
> <font color="red">
> <xsl:apply-templates/>
> </font>
> </strong>
> </xsl:template>
> </xsl:template>
  ^^^^^^^^^^^^^^^
> <xsl:template match="*">
> <xsl:copy><xsl:apply-templates/> </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>

  Is this exactly what you give to your XSLT processor?  What's the
error message?  BTW, this not copy the attributes.  And finaly you try
to match 'strong' in no namespace, and your have in your source a
'strong' in the XHTML namespace; is it really what you want?

    ~/drafts/fctx> cat mus47.xml
    <?xml version="1.0" encoding="utf-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml";>
      <body>
        <strong>abcd</strong>
        <i>abcd</i>
      </body>
    </html>

    ~/drafts/fctx> cat mus47.xsl
    <?xml version="1.0"?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:h="http://www.w3.org/1999/xhtml";>
      <xsl:template match="h:strong">
        <h:strong>
          <h:font color="red">
            <xsl:apply-templates/>
          </h:font>
        </h:strong>
      </xsl:template>
      <xsl:template match="@*|node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>

    ~/drafts/fctx> saxon mus47.xml mus47.xsl 
    Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
    <?xml version="1.0" encoding="UTF-8"?><html
xmlns="http://www.w3.org/1999/xhtml";>
      <body>
        <h:strong xmlns:h="http://www.w3.org/1999/xhtml";><h:font
color="red">abcd</h:font></h:strong>
        <i>abcd</i>
      </body>
    </html>

--drkm



	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Tilichargez cette version sur http://fr.messenger.yahoo.com

Current Thread