xsl-list
[Top] [All Lists]

RE: Newbie - apply-templates

2004-09-30 17:09:45
David, please post your XML and XSL "as they are". 
Then tell us what output you wish to have.

HTH,
<prs/>

-----Original Message-----
From: David [mailto:gaudimila(_at_)yahoo(_dot_)com] 
Sent: Thursday, September 30, 2004 5:43 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Newbie - apply-templates

I think this is a pretty basic question...

I've got a document of the following form (transforming to html).  I need
any mention of the state name (e.g. "California") to be inserted where the
[statename/] element is.  I don't know how to write the XSLT transformation
for this to work.    I put below my first stab at the XSLT code, but I know
it's incomplete. 

I think the part I'm having difficulty with relates to the fact that
[statename/] appears - possibly multiple times - within the body text of an
element.  I don't think I've ever had to code for a situation like this.

Thanks!
David

[doc]
            [body]
                        [para]Summary of Laws for [statename/][/para]
       [para]The laws in [statename/] are favorable to defendants.  If you
live in [statename/] then your outcome is secure.[/para]
            [/body]
[/doc]

And XSLT of the form:

[xsl:template match="/doc"]
            [html]
                        [xsl:apply-templates/]
            [/html]
[/xsl:template]

[xsl:template match="body"]
            [body]
                        [xsl:apply-templates/]
            [/body]
[/xsl:template]

[xsl:template match="para"]
            [p][xsl:apply-templates/][/p] [/xsl:template]

[xsl:template match="statename"]
            [xsl:value-of select="$statename"/] [/xsl:template]




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


<Prev in Thread] Current Thread [Next in Thread>