xsl-list
[Top] [All Lists]

Re: First attempt at xsl:result-document

2005-04-25 12:07:37
Hi Jay,

Thanks once again for the reply. I've retested my application and do
not think the URI is the problem. As an example

.
.
.
<xsl:for-each select="part">
<xsl:variable name="filename" select="concat('file:///', position(), '.htm'"/>
<xsl:result-document href={$filename}" format="html">
<html>
<body>

<!-- Test -->
<xsl:value-of="/act/title"/>
<!--End of Test -->

<xsl:apply-templates mode="content"/>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>

Now let's say I have 4 parts in an xml document. I do get 5 files in
the end (1 table of contents and 4 parts) and each file is named as
expected and each file picks up the title. However none of the files
pick up any content from the <xsl:apply-templates mode="content"/>.
I'm sure it's not the templates fault as I used exactly the same ones
when I created my original document. It seems to be matching the
templates within a for-each statement. To be sure here is an example
of a template:

<xsl:template match="section" mode="content">
<div class="section"><xsl:apply-templates
select="text()|strong|em|sup|sub|u|br"/></div>
</xsl:template>

<xsl:template match="strong|em|u|sup|sub|strong">
        <xsl:element name="{name()}">
        <xsl:apply-templates/>
        </xsl:element>
</xsl:template>



On 4/25/05, JBryant(_at_)s-s-t(_dot_)com <JBryant(_at_)s-s-t(_dot_)com> wrote:
Well, you could try setting the base URI. According to the spec, that's
implementation-specific, so you'll have to consult your XSLT processor's
documentation.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

Spencer Tickner <spencertickner(_at_)gmail(_dot_)com>
04/25/2005 12:31 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com

To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc

Subject
Re: [xsl] First attempt at xsl:result-document


Hi Jay,

Thanks for the response. I did try stripping out the file:/// and I
get a java.lang.RuntimeException: "Resolved URL is malformed". This
may be because I tried to really strip down my code to make my problem
more visible on the list. in truth the variable is something more like
<xsl:variable name="filname"
select=concat('file:///W:/test/testing/b/, $myindex, '_', position(),
'.htm')"/>

On 4/25/05, JBryant(_at_)s-s-t(_dot_)com <JBryant(_at_)s-s-t(_dot_)com> wrote:
Hi, Spencer,

When I tried your XML and XSL files (after filling in the necessary
pieces), I found that I got no output unless I removed the "file:///"
part
of the href value.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

Spencer Tickner <spencertickner(_at_)gmail(_dot_)com>
04/25/2005 11:59 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com

To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc

Subject
[xsl] First attempt at xsl:result-document


Hi everyone, and thanks in advance for the help.

I have a magical and wonderful xsl that was doing everything I needed
it too. Unfortunately as this buisness goes, requirements changed.
Some of the html documents I was producing were getting too large for
our website. The decision was made to split the larger ones up by
part. So after some research I found xsl:result-document. Here is some
sample xml, my single file xsl transformer and my attempt at
multi-file transformation.

xml

<act>
<part>this is a part we will divide a file on</part>
<section>This is a section</section>
<clause>This is a clause</clause>
<part>This is another part, in the new scheme of things, a second
file</part>
<section>Yet another section</section>
</act>

original xsl (works fine)

<xsl:template match="act">

<html>
<body>
<xsl:apply-templates mode="tableofcontents"/>
<xsl:apply-templates mode="content"/>
</body>
</html>

</xsl:template>
<!-- Down here of course I have the templates that apply the styles
for either mode -->

new xsl (well, not so fine)

<xsl:template match="act">

<xsl:result-document href="file:///toc.html" format="html">
<html>
<body>
<xsl:apply-templates mode="tableofcontents"/>
</body>
</html>
</xsl:result-document>

<xsl:for-each select="part">
<xsl:variable name="filename" select="concat('file:///', position(),
'.htm'"/>
<xsl:result-document href={$filename}" format="html">
<html>
<body>
<xsl:apply-templates mode="content"/>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>

<!-- Exact same  templates that apply the styles for either mode as
original xsl -->

In the new xsl, I get the tableof contents no problem. in terms of
content I get a number of files (same as the number of parts) with no
content in them. I realize that the for-each statement probably
doesn't do what I'm hoping it will do, but I can't quite wrap my mind
around any other ways of doing this. I would really appreciate any
suggestions or advice.

Thank you all very much,

Spencer

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

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



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

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



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