How to do a xsl-template match for a html string
I have a scenario where i need to render html in the pdf using XSLT. I have some html contents in xml file like
<section>
<p><b><u>Heelo</u></b></p>
</section>
I need to render this in the pdf.
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
But this template match is not working. How to achieve this or is there any way to replace < as < and > as > while creating xml in java?
Thanks for the help in advance !!!
java html xml xslt xsl-fo
add a comment |
I have a scenario where i need to render html in the pdf using XSLT. I have some html contents in xml file like
<section>
<p><b><u>Heelo</u></b></p>
</section>
I need to render this in the pdf.
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
But this template match is not working. How to achieve this or is there any way to replace < as < and > as > while creating xml in java?
Thanks for the help in advance !!!
java html xml xslt xsl-fo
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12
add a comment |
I have a scenario where i need to render html in the pdf using XSLT. I have some html contents in xml file like
<section>
<p><b><u>Heelo</u></b></p>
</section>
I need to render this in the pdf.
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
But this template match is not working. How to achieve this or is there any way to replace < as < and > as > while creating xml in java?
Thanks for the help in advance !!!
java html xml xslt xsl-fo
I have a scenario where i need to render html in the pdf using XSLT. I have some html contents in xml file like
<section>
<p><b><u>Heelo</u></b></p>
</section>
I need to render this in the pdf.
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
But this template match is not working. How to achieve this or is there any way to replace < as < and > as > while creating xml in java?
Thanks for the help in advance !!!
java html xml xslt xsl-fo
java html xml xslt xsl-fo
asked Dec 30 '18 at 14:02
Pradeep AnandPradeep Anand
296
296
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12
add a comment |
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12
add a comment |
1 Answer
1
active
oldest
votes
If you want to parse HTML you need a way to integrate an HTML parser, that is possible with an XSLT 2 processor if you use David Carlisle's HTML parser implementation in XSLT 2 from https://github.com/davidcarlisle/web-xslt/blob/master/htmlparse/htmlparse.xsl, you can then import it and call the function to parse the content of the section
element into nodes to be processed by your templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d="data:,dpc"
exclude-result-prefixes="#all"
version="3.0">
<xsl:import href="https://raw.githubusercontent.com/davidcarlisle/web-xslt/master/htmlparse/htmlparse.xsl"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="d:htmlparse(., '', true())/node()"/>
</fo:block>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/94hvTAp
I have used your templates as shown in your question but note that you can simplify all the uses of <xsl:apply-templates select="*|text()" />
to <xsl:apply-templates/>
normally.
Other ways depend on the particular XSLT processor used (i.e. whether it offers an extension like http://saxonica.com/html/documentation/functions/saxon/parse-html.html or whether it allows you to implement your own extension functions integrating an HTML parser).
If the HTML is well-formed XML (e.g. has all necessary end tags and quotes attributes, doesn't use HTML specific entity references) then you can also use the XPath 3.1 function parse-xml-fragment
with an XSLT 3 processor like Saxon 9.8 or later:
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="parse-xml-fragment(.)/node()"/>
</fo:block>
</xsl:template>
https://xsltfiddle.liberty-development.net/94hvTAp/1
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53978233%2fhow-to-do-a-xsl-template-match-for-a-html-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want to parse HTML you need a way to integrate an HTML parser, that is possible with an XSLT 2 processor if you use David Carlisle's HTML parser implementation in XSLT 2 from https://github.com/davidcarlisle/web-xslt/blob/master/htmlparse/htmlparse.xsl, you can then import it and call the function to parse the content of the section
element into nodes to be processed by your templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d="data:,dpc"
exclude-result-prefixes="#all"
version="3.0">
<xsl:import href="https://raw.githubusercontent.com/davidcarlisle/web-xslt/master/htmlparse/htmlparse.xsl"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="d:htmlparse(., '', true())/node()"/>
</fo:block>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/94hvTAp
I have used your templates as shown in your question but note that you can simplify all the uses of <xsl:apply-templates select="*|text()" />
to <xsl:apply-templates/>
normally.
Other ways depend on the particular XSLT processor used (i.e. whether it offers an extension like http://saxonica.com/html/documentation/functions/saxon/parse-html.html or whether it allows you to implement your own extension functions integrating an HTML parser).
If the HTML is well-formed XML (e.g. has all necessary end tags and quotes attributes, doesn't use HTML specific entity references) then you can also use the XPath 3.1 function parse-xml-fragment
with an XSLT 3 processor like Saxon 9.8 or later:
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="parse-xml-fragment(.)/node()"/>
</fo:block>
</xsl:template>
https://xsltfiddle.liberty-development.net/94hvTAp/1
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
add a comment |
If you want to parse HTML you need a way to integrate an HTML parser, that is possible with an XSLT 2 processor if you use David Carlisle's HTML parser implementation in XSLT 2 from https://github.com/davidcarlisle/web-xslt/blob/master/htmlparse/htmlparse.xsl, you can then import it and call the function to parse the content of the section
element into nodes to be processed by your templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d="data:,dpc"
exclude-result-prefixes="#all"
version="3.0">
<xsl:import href="https://raw.githubusercontent.com/davidcarlisle/web-xslt/master/htmlparse/htmlparse.xsl"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="d:htmlparse(., '', true())/node()"/>
</fo:block>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/94hvTAp
I have used your templates as shown in your question but note that you can simplify all the uses of <xsl:apply-templates select="*|text()" />
to <xsl:apply-templates/>
normally.
Other ways depend on the particular XSLT processor used (i.e. whether it offers an extension like http://saxonica.com/html/documentation/functions/saxon/parse-html.html or whether it allows you to implement your own extension functions integrating an HTML parser).
If the HTML is well-formed XML (e.g. has all necessary end tags and quotes attributes, doesn't use HTML specific entity references) then you can also use the XPath 3.1 function parse-xml-fragment
with an XSLT 3 processor like Saxon 9.8 or later:
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="parse-xml-fragment(.)/node()"/>
</fo:block>
</xsl:template>
https://xsltfiddle.liberty-development.net/94hvTAp/1
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
add a comment |
If you want to parse HTML you need a way to integrate an HTML parser, that is possible with an XSLT 2 processor if you use David Carlisle's HTML parser implementation in XSLT 2 from https://github.com/davidcarlisle/web-xslt/blob/master/htmlparse/htmlparse.xsl, you can then import it and call the function to parse the content of the section
element into nodes to be processed by your templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d="data:,dpc"
exclude-result-prefixes="#all"
version="3.0">
<xsl:import href="https://raw.githubusercontent.com/davidcarlisle/web-xslt/master/htmlparse/htmlparse.xsl"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="d:htmlparse(., '', true())/node()"/>
</fo:block>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/94hvTAp
I have used your templates as shown in your question but note that you can simplify all the uses of <xsl:apply-templates select="*|text()" />
to <xsl:apply-templates/>
normally.
Other ways depend on the particular XSLT processor used (i.e. whether it offers an extension like http://saxonica.com/html/documentation/functions/saxon/parse-html.html or whether it allows you to implement your own extension functions integrating an HTML parser).
If the HTML is well-formed XML (e.g. has all necessary end tags and quotes attributes, doesn't use HTML specific entity references) then you can also use the XPath 3.1 function parse-xml-fragment
with an XSLT 3 processor like Saxon 9.8 or later:
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="parse-xml-fragment(.)/node()"/>
</fo:block>
</xsl:template>
https://xsltfiddle.liberty-development.net/94hvTAp/1
If you want to parse HTML you need a way to integrate an HTML parser, that is possible with an XSLT 2 processor if you use David Carlisle's HTML parser implementation in XSLT 2 from https://github.com/davidcarlisle/web-xslt/blob/master/htmlparse/htmlparse.xsl, you can then import it and call the function to parse the content of the section
element into nodes to be processed by your templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d="data:,dpc"
exclude-result-prefixes="#all"
version="3.0">
<xsl:import href="https://raw.githubusercontent.com/davidcarlisle/web-xslt/master/htmlparse/htmlparse.xsl"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="d:htmlparse(., '', true())/node()"/>
</fo:block>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="u">
<fo:inline text-decoration="underline">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
<xsl:template match="i">
<fo:inline font-style="italic">
<xsl:apply-templates select="*|text()" />
</fo:inline>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/94hvTAp
I have used your templates as shown in your question but note that you can simplify all the uses of <xsl:apply-templates select="*|text()" />
to <xsl:apply-templates/>
normally.
Other ways depend on the particular XSLT processor used (i.e. whether it offers an extension like http://saxonica.com/html/documentation/functions/saxon/parse-html.html or whether it allows you to implement your own extension functions integrating an HTML parser).
If the HTML is well-formed XML (e.g. has all necessary end tags and quotes attributes, doesn't use HTML specific entity references) then you can also use the XPath 3.1 function parse-xml-fragment
with an XSLT 3 processor like Saxon 9.8 or later:
<xsl:template match="section">
<fo:block>
<xsl:apply-templates select="parse-xml-fragment(.)/node()"/>
</fo:block>
</xsl:template>
https://xsltfiddle.liberty-development.net/94hvTAp/1
edited Dec 30 '18 at 14:33
answered Dec 30 '18 at 14:25
Martin HonnenMartin Honnen
111k65976
111k65976
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
add a comment |
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
Hi Martin, Im using XSLT 1.0 with xalan in it, so is there any parser which supports xslt 1.0
– Pradeep Anand
Dec 30 '18 at 16:43
2
2
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
With Java it is easy to switch from Xalan and XSLT 1 to Saxon 9 (Saxon 9 HE is open-source at sourceforge.net/projects/saxon/files/Saxon-HE respectively mvnrepository.com/artifact/net.sf.saxon/Saxon-HE) and XSLT 2/3. I doubt anyone has done an HTML parser in XSLT 1 but of course plugging in any HTML parser implemented in Java into your workflow with Xalan should also be possible, see xalan.apache.org/old/xalan-j/extensions.html.
– Martin Honnen
Dec 30 '18 at 18:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53978233%2fhow-to-do-a-xsl-template-match-for-a-html-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you able to use XSLT 3.0?
– Tim C
Dec 30 '18 at 14:12