|
Subject: RE: [xsl] Output XML just as it is... From: Jarno.Elovirta@xxxxxxxxx Date: Tue, 2 Mar 2004 10:44:05 +0200 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Output XML just as it is., Elliotte Rusty Harol | Thread | [xsl] Identity Transformations, Karl J. Stubsjoen |
| [xsl] Output XML just as it is..., Karl J. Stubsjoen | Date | Re: [xsl] Preserve Space in Variabl, David Carlisle |
| Month |