diff options
author | Adrian Kummerländer | 2014-04-18 19:51:24 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-04-18 19:51:24 +0200 |
commit | 6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b (patch) | |
tree | f0a9709d7d09786585220ff0c27ceae97d7a4b87 /dummy | |
parent | e886ac3a4f2dacc79cf174b1257146fd91bf6b7c (diff) | |
download | InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar.gz InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar.bz2 InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar.lz InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar.xz InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.tar.zst InputXSLT-6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b.zip |
Implemented basic XML reading capabilities
* command "read-xml-file" reads a XML file and allows it to be transformed by the calling XSLT
* this will allow workflows like the following:
** a tranformation reads all the markdown files in a directory
** these markdown files are converted to a xml representation by a external function calling a appropriate C++ markdown parser
** the XML representation of each markdown file is converted to XHTML inside the XSL transformation
** ... and embedded into the output XHTML document
** => all inside a single XSL tranformation
*** i.e. it is provided with only a empty dummy XML input file and fetches the actual input by itself
* as all current code contained within this repository this is just a quick and dirty proof-of-concept and not in any way good code
Diffstat (limited to 'dummy')
-rw-r--r-- | dummy/in.xml | 7 | ||||
-rw-r--r-- | dummy/test.txt | 8 | ||||
-rw-r--r-- | dummy/transform.xsl | 15 |
3 files changed, 16 insertions, 14 deletions
diff --git a/dummy/in.xml b/dummy/in.xml index 7b512bc..6abcacd 100644 --- a/dummy/in.xml +++ b/dummy/in.xml @@ -1,7 +1,2 @@ <?xml version="1.0"?> -<items> - <item>Test1</item> - <item>Test2</item> - <item>Test3</item> - <item>Test4</item> -</items> +<dummy /> diff --git a/dummy/test.txt b/dummy/test.txt index cd08755..046a6ef 100644 --- a/dummy/test.txt +++ b/dummy/test.txt @@ -1 +1,7 @@ -Hello world! +<?xml version="1.0"?> +<tester> + <eintrag>Hello 1</eintrag> + <eintrag>Hello 2</eintrag> + <eintrag>Hello 3</eintrag> + <eintrag>Hello 4</eintrag> +</tester> diff --git a/dummy/transform.xsl b/dummy/transform.xsl index bd7cbc7..08d005b 100644 --- a/dummy/transform.xsl +++ b/dummy/transform.xsl @@ -15,17 +15,18 @@ <head> </head> <body> - <xsl:apply-templates select="items/item" /> + <div id="raw"> + <xsl:value-of select="external:read-file('../dummy/test.txt')" /> + </div> + <ul> + <xsl:for-each select="external:read-xml-file('../dummy/test.txt')/tester/eintrag"> + <li><xsl:value-of select="."/></li> + </xsl:for-each> + </ul> </body> </html> </xsl:template> -<xsl:template match="items/item"> - <div id="{.}"> - <xsl:value-of select="external:read-file('../dummy/test.txt')" /> - </div> -</xsl:template> - </xsl:stylesheet> |