docx-xslt-1.0.4
توضیحات
XSL transformation for Microsoft Word .docx files
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | docx-xslt-1.0.4 |
| نام | docx-xslt |
| نسخه کتابخانه | 1.0.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Frank Bohnsack |
| ایمیل نویسنده | frank.bohnsack@gmail.com |
| آدرس صفحه اصلی | https://github.com/backbohne/docx-xslt |
| آدرس اینترنتی | https://pypi.org/project/docx-xslt/ |
| مجوز | The MIT License (MIT) Copyright (c) 2013 Steve Canny, https://github.com/scanny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
docx-xslt
=========
docx-xslt is a Python library for adding XSL transformation for
Microsoft Word .docx files without XML or XSLT coding.
The module uses Word meta text which has been formated with a specific
character template called XSL, add XSL code and applies XSL
transformation with the XML context.
The meta text has the following syntax:
<meta text> ::= <command list>
<command list> ::= <command expr> | <command list>
<command expr> ::= 'xsl' ':' <context expr> <xsl command expr> <xsl option expr>
<context expr> ::= ':' <context type> |
<context type> ::= 'body' | 'p0' | 'p' | 'r' | 't' | 'tbl' | 'tr' | 'tc'
<xsl command expr> ::= <meta command> | <xsl command>
<meta command> ::= 'meta' <meta sub command>
<meta sub command> ::= 'up' | 'prev' | 'next' | 'cloneprev' | 'clonenext' | 'delete'
<xsl command> ::= 'for-each' | 'choose' | 'when' | 'otherwise' | 'if' | 'sort' | 'value-of' | 'text'
<xsl option expr> ::= <text> | <xsl option name> '=' <xsl option value>
<text> ::= ...
<xsl option name> ::= 'select' | 'test'
<xsl option value> ::= xpath expr
To insert a list of a product names, just add
xsl:for-each select=.//products/* xsl:t:value-of select=name and format
the text with the XSL template.
~~~~ {.python}
from lxml import etree
from docxxslt import DocxXsltTemplate
context = etree.parse("products.xml")
template = DocxXsltTemplate(filename)
template.save(context=context)
~~~~
Installing
----------
~~~~ {.bash}
pip install docx-xslt
~~~~
نحوه نصب
نصب پکیج whl docx-xslt-1.0.4:
pip install docx-xslt-1.0.4.whl
نصب پکیج tar.gz docx-xslt-1.0.4:
pip install docx-xslt-1.0.4.tar.gz