You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Brian Tol <br...@imagegroup.com> on 2001/07/02 15:26:45 UTC

Capturing relevant source document during XSLT processing

For an upcoming project I'll need to be capturing the relevant part of a
source document during XSLT processing. For example:
 
Source:
<person>
    <firstname>Bob</firstname>
    <lastname>Smith</lastname>
</person>
 
Stylesheet:
<xsl:stylesheet>
    
<xsl:template match="/">
   Firstname: <xsl:value-of select="firstname"/>
</xsl:template>
 
</xsl:stylesheet>
 
Output:
Firstname: Bob
 
What I need to capture is the "relevant" (is there a better word?) part
of the source document:
 
<person>
    <firstname>bob</firstname>
</person>
 
I've looked around for something to do this, but I haven't found
anything. Is there a tool out there to do this, and if not, any
suggestions on how to add this functionality to a XSLT processor?
 
Thanks,
Brian
 
briant@imagegroup.com

Re: Capturing relevant source document during XSLT processing

Posted by Patrick Durusau <pd...@emory.edu>.
Brian,

I think you are more likely to find the answer to this (and other) XSTL
questions on the XSL-List (see http://www.mulberrytech.com/xsl/xsl-list/
for archives, subscription information, etc.)

When you post your question, please indicate if you are trying to
display:

Firstname: Bob

or 

are you extracting:

<person>
 
     <firstname>bob</firstname>
 
</person>

for further processing?

It makes a difference in the solution. (although not much)

If you are only trying for the display: Firstname: Bob (as in an HTML
document or something similar) Michael Kay covers sample code that leads
to that result in Chapter 2 of XSLT (2nd edition). If you are going to
be doing any serious amount of XSLT work, get Kay's book (not meant as a
comment on others, choice depends on your personal style) and subscribe
to the XSL-List (asking questions after you search the archives and the
FAQ).

Kay also covers selecting nodes for further processing (in XSLT) if that
was the intent of your question.

Hope this helps!

Patrick

-- 
Patrick Durusau
Director of Research and Development
Society of Biblical Literature
pdurusau@emory.edu


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org