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

Re: Entity Questions

Subject: Re: Entity Questions
From: "Luke Shannon" <lshannon@xxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2005 17:56:28 -0500
xsl entity
Thanks Michael, I have a lot to learn in this area. Also the sytem I am
working with was not written by someone who knew alot about XSL either.

So taking this template for example:

<!-- the html i am looking at is machine generated and in all caps -->
<xsl:template match="P">
<fo:block>
  <xsl:apply-templates/>
 </fo:block>
</xsl:template>

This is matching a P node (<P>) and replacing it with the <fo:block>the
contents of the matched node</fo:block>.

Is this correct?

If this is correct than I should be able to do the following:

<!-- output the text from the xml document -->
<xsl:template name="text_display_and_edit">
<xsl:param name="text_number" />
<xsl:param name="textname" select="concat('TEXT',$text_number)" />
<xsl:if test="DATA/VERSION/ITEM[@NAME=$textname] !=''" >
<xsl:value-of select="DATA/VERSION/ITEM[@NAME=$textname]"/>
</xsl:if>
</xsl:template>

<!-- this template will catch the <P> and output their contents inside of
<fo:block> instead-->
<xsl:template match="P">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</xsl:template>

Is this making more sense?

One thing I don't understand. How does <xsl:apply-template/> manage to write
the content of the node out?

Thanks,

Luke



----- Original Message ----- 
From: "Michael Kay" <mike@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, January 17, 2005 5:14 PM
Subject: RE:  Entity Questions


> > The template this starts in begins like this:
> >
> > <xsl:template match="*" mode="_KCXFILE_">
> >
> > NOTE:
> > _KCXFILE_ contains the XML document.
>
> No, a mode doesn't contain anything. It's a label for a template rule that
> must match the mode specified when apply-templates is called: this allows
> you to invoke different rules to process the same nodes under different
> conditions.
>
>  This is an existing
> > system, I didn't
> > write it so am not clear on why certain things were done the
> > way they were.
> >
> >  This template outputs all the FO tags to start the FO
> > document.
>
> It's sometimes natural to think of the transformation outputting the start
> tag, then the content, then the end tag. But that's not the XSLT
processing
> model, and it's as well to get the right model into your head. When you
see
> this in the stylesheet
>
> <b><xsl:apply-templates/></b>
>
> you are seeing two element nodes: a b element and an xsl:apply-templates
> element. The b element is evaluated to produce a b element in the result
> tree. The xsl:apply-templates element is evaluated to produce the children
> of the b element in the result tree. There are two actions here, not
three.
> The start and end tags are produced only when the result tree is
serialized;
> writing an element to the result tree is an atomic operation.
>
> You can easily spot the people who haven't understood this: they sprinkle
> their stylesheets liberally with "disable-output-escaping".
>
> >
> > While the content is being outputed there are sometimes HTML
> > tags. I want
> > the system to switch those out for FO tags.
>
> So you want to substitute template rules that output FO elements for the
> existing template rules that output HTML elements.
> >
> > It is within this template I would like to examine each
> > output before it is
> > actually outputed for tags I would like to replace.
>
> No, that's not the way to tackle it. Don't generate the HTML and then
modify
> it, replace the rules that generate HTML with rules that generate FO.
>
> Michael Kay
> http://www.saxonica.com/

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.