PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.16k stars 2.68k forks source link

Applying XSLT to Word Template while Template Processing #734

Open vivek-chaudhari opened 8 years ago

vivek-chaudhari commented 8 years ago

I want to add page break after some contents in word template while template processing.I googling some things and found that this is possible using XSLT "TemplateProcessor::applyXslStyleSheet". I have loaded xslt file but does nothing.This is my xslt file.

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">

<!-- <xsl:template match="/">
    <xsl:apply-templates/>
    <xsl:processing-instruction name="hard-pagebreak" />
</xsl:template> -->

<xsl:template match="processing-instruction('hard-pagebreak')">
   <fo:block break-after='page'/>
</xsl:template>
<xsl:template match='@*|node()'>
    <xsl:copy>
        <xsl:apply-templates select='@*|node()'/>
        <xsl:processing-instruction name="hard-pagebreak" />
    </xsl:copy>
</xsl:template>

/xsl:stylesheet

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30970634-applying-xslt-to-word-template-while-template-processing?utm_campaign=plugin&utm_content=tracker%2F323108&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F323108&utm_medium=issues&utm_source=github).
falahatiali commented 4 years ago

what did you do? have you solved this problem?