Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an XSLT DSL #123

Open
lukaseder opened this issue Jun 19, 2014 · 0 comments
Open

Add support for an XSLT DSL #123

lukaseder opened this issue Jun 19, 2014 · 0 comments

Comments

@lukaseder
Copy link
Member

For very simple XSL transformations, it might be useful to implement a simple DSL that allows for constructing XSL templates on the fly:

stylesheet(
    template(
        match("book"),
        element("book",
            attribute("id", "{@id + 1}"),
            applyTemplates()
        )
    ),

    template(
        match("@*|*|processing-instruction()|comment()"),
        copy(
            applyTemplates(select("*|@*|text()|processing-instruction()|comment()"))
        )
    )
);

The above would roughly be equivalent to:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="book">
        <book id="{@id + 1}">
            <xsl:apply-templates/>
        </book>
    </xsl:template>

    <xsl:template match="@*|*|processing-instruction()|comment()">
        <xsl:copy>
            <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Possibly, the DSL could be generated from the XSL XSD

@lukaseder lukaseder added this to the Version 1.3.0 milestone Jun 19, 2014
@lukaseder lukaseder modified the milestones: Version 1.3.0, Version 1.4.0 Apr 8, 2015
@lukaseder lukaseder modified the milestones: Version 1.4.0, Version 1.5.0 May 3, 2016
@lukaseder lukaseder modified the milestones: Version 1.6.0, Version 1.7.0 Nov 30, 2017
@lukaseder lukaseder modified the milestones: Version 2.0.0, Version 2.1.0 Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant