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

RE: Output XML just as it is...

Subject: RE: Output XML just as it is...
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 2 Mar 2004 10:44:05 +0200
xsl output xml
Hi,

> <campaign>
>     <table width="100%">
>         <tr><td colspan="2">You say Yes</td></tr>
>         <tr><td>I say no</td>
>         <td>You say goodbye</td></tr>
>     </table>
>     <img src="/images/some_image.gif"/>
> </campaign>
> 
> I am trying to implement this from XSL like this:
> 
> <xsl:template match="/">
>     <!-- reference external xml/xhtml source-->
>         <xsl:variable name="c"
> select="document('../campaigns/simpleone.xml')//campaign"/>
>         <xsl:value-of disable-output-escaping="yes" select="$c"/>
> </xsl:template>
> 
> ( Returned raw text... HTML stripped )

You want xsl:copy-of instead of xsl:value-of.
 
> Then I tried something like this
> 
> <xsl:template name="PREVIEW">
>     <xsl:variable name="c" 
> select="document('../campaigns/simpleone.xml')"/>
>     <xsl:apply-templates select="$c"/>
> </xsl:template>
> 
> <xsl:template match="*">
>  <xsl:value-of select="."/>
> </xsl:template>
> 
> ( However, could not come up with any results, could not make 
> a match )
> 
> And if I need to alter the SRC tag?  Could I do this:
> <xsl:template match="img">
>     <!-- then simply re-create img element, iterate through 
> properties,
> where property is "src" concat and add necessary full path -->
> </xsl:template>

In that case, use xsl:apply-templates to process the contents of $c, add an identity transformation template

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

and a template to match the src attribute

  <xsl:template match="@src">
    <xsl:attribute name="src">http://foo.bar.com<xsl:value-of select="."/><xsl:attribute>
  </xsl:template>

> ( If I do that, I don't quite understand where I would 
> apply-templates... )

You read the XPath and XSLT specs or a good book on the subject, makes learning the language a lot easier.

Cheers,

Jarno - Chris C: The Zurich Mix

 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.