[
Lists Home |
Date Index |
Thread Index
]
Hi All,
I know this probably isn't the best forum for this, although, I would
love to hear how the processor handles this, anyway, here's my question.
I have an XSLT that is transforming some data into HTML. I am trying to
generate some HTML code in a template, but for some reason, the BR tags
are not being added to the result. Strangely enough, if I do this in the
XSLT in a literal way, it works just fine. I'm checking these out in the
IE and Netscape browsers, and I get the same results for both, so I'm
pretty sure it's not a bug.
Here is an example of the code. I tried to make it as accurate to what
I was doing as possible, so it is a touch verbose (sorry about that, but
it might be pertinent). I have also attached the 2 example files:
<!-- XML DATA -->
<!-- Saved as MyBRProb.xml -->
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='MyBRProb.xsl'?>
<prb xmlns="www.MyBRProblem.org">
<issue id="01">
<description>
<problem-area>
<entry id="1">
<date>01/01/2001 12:00:00 AM</date>
<text>A BR problem for this "thing"</text>
</entry>
<entry id="2">
<person ref-id="01"/>
<date>01/01/2001 12:00:01 AM</date>
<text>More problems</text>
</entry>
</problem-area>
</description>
</issue>
<person-info>
<person id="01">
<first>Christopher</first>
<last>Strolia-Davis</last>
</person>
</person-info>
</prb>
<!-- ************************************************************ -->
<!-- XSL SHEET -->
<!-- Saved as MyBRProb.xml -->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:prb="www.MyBRProblem.org">
<xsl:output method="html"/>
<!--
PAGE
-->
<xsl:template match="/">
<xsl:element name="html">
<xsl:element name="head">
<xsl:element name="meta">
<xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
<xsl:attribute name="content">text/html; charset=iso-8859-1</xsl:attribute>
</xsl:element>
<xsl:element name="title">
<xsl:text>Test BR problem</xsl:text>
</xsl:element>
</xsl:element>
<xsl:element name="body">
<xsl:element name="div">
<xsl:call-template name="page-body"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
PAGE-BODY
-->
<xsl:template name="page-body">
<xsl:element name="table">
<xsl:attribute name="cellspacing">2</xsl:attribute>
<xsl:attribute name="cellpadding">2</xsl:attribute>
<xsl:attribute name="width">100%</xsl:attribute>
<xsl:attribute name="class">Container</xsl:attribute>
<xsl:attribute name="summary">A table that contains sections, one of which is having a BR tag problem</xsl:attribute>
<xsl:element name="tbody">
<xsl:apply-templates select="prb:prb/prb:issue/prb:description"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
DESCRIPTION-SECTION
-->
<xsl:template match="prb:description">
<!--
Problem Area
-->
<xsl:call-template name="data-row">
<xsl:with-param name="row-title">Problem Area</xsl:with-param>
<xsl:with-param name="row-value">
<xsl:apply-templates select="prb:problem-area/prb:entry" mode="blob-multi"/>
</xsl:with-param>
</xsl:call-template>
<!-- THIS CODE SEEMS TO WORK FOR SOME REASON, BUT THE TEMPLATE -->
<!-- WHICH IS SUPPOSED TO CRANK OUT THE SAME OUTPUT DOESN'T -->
<!-- SEEM TO WORK -->
<xsl:element name="tr">
<xsl:element name="th" use-attribute-sets="field-row-header">
<xsl:text>Problem Area</xsl:text>
</xsl:element>
<xsl:element name="td">
<xsl:attribute name="class">field-data</xsl:attribute>
<xsl:text>A BR problem for this "thing"</xsl:text>
<xsl:element name="br"/>
<xsl:text>---------------------------------------------</xsl:text>
<xsl:element name="br"/>
<xsl:text>Christopher Strolia-Davis on 01/01/2001 12:00:01 AM EDT</xsl:text>
<xsl:element name="br"/>
<xsl:text>More problems</xsl:text>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
DATA-ROW-TEMPLATE
-->
<xsl:template name="data-row">
<xsl:param name="row-title"/>
<xsl:param name="row-value"/>
<xsl:element name="tr">
<xsl:element name="th" use-attribute-sets="field-row-header">
<xsl:value-of select="$row-title"/>
</xsl:element>
<xsl:element name="td">
<xsl:attribute name="class">field-data</xsl:attribute>
<xsl:value-of select="$row-value"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
PERSON-NAME-TEMPLATES
-->
<xsl:template match="@ref-id" mode="get-name">
<xsl:variable name="person-id" select="."/>
<xsl:value-of select="/prb:prb/prb:person-info/prb:person[@id=$person-id]/prb:first"/>
<xsl:apply-templates select="/prb:prb/prb:person-info/prb:person[@id=$person-id]/prb:last" mode="r-name"/>
<xsl:apply-templates select="/prb:prb/prb:person-info/prb:person[@id=$person-id]/prb:mi" mode="r-name"/>
</xsl:template>
<xsl:template match="prb:last|prb:mi" mode="r-name">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<!-- HERE IS THE MAIN PROBLEM CODE I AM HAVING -->
<!--
BLOB-TEXT-MULTIPLE-ENTRY-TEMPLATE
-->
<xsl:template match="prb:entry" mode="blob-multi">
<xsl:if test="position()>1">
<br/>
<xsl:text>---------------------------------------------</xsl:text>
<xsl:element name="br"/>
<xsl:apply-templates select="prb:person/@ref-id" mode="get-name"/>
<xsl:text> on </xsl:text>
<xsl:value-of select="prb:date"/>
<xsl:text> EDT</xsl:text>
<xsl:element name="br"/>
</xsl:if>
<xsl:value-of select="prb:text"/>
</xsl:template>
</xsl:stylesheet>
<!-- ************************************************************ -->
Thanks in advance for any help.
Chris Strolia-Davis
Database Specialist
Contractor - CDO Technologies Inc.
MyBRProb.xsl
MyBRProb.xml
|