xsl-list
[Top] [All Lists]

RE: Entity Questions

2005-01-17 16:02:17
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?

Yes that's 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[(_at_)NAME=$textname] !=''" >
<xsl:value-of select="DATA/VERSION/ITEM[(_at_)NAME=$textname]"/>
</xsl:if>
</xsl:template>

You've shown this named template several times, but you haven't shown any
code that calls it, or the section of the source document that it's
processing. A named template is invoked using xsl:call-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>

This is just the template rule you showed us before.

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?


It does it indirectly. It selects some nodes from the source document; the
template rules that match those nodes are activated, and instructions within
those template rules, such as <B>...</B> or <xsl:value-of select="@x"/>,
write nodes to the result tree.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>