How to do a xsl-template match for a html string












0















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>
&lt;p&gt;&lt;b&gt;&lt;u&gt;Heelo&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
</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 !!!










share|improve this question























  • Are you able to use XSLT 3.0?

    – Tim C
    Dec 30 '18 at 14:12
















0















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>
&lt;p&gt;&lt;b&gt;&lt;u&gt;Heelo&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
</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 !!!










share|improve this question























  • Are you able to use XSLT 3.0?

    – Tim C
    Dec 30 '18 at 14:12














0












0








0








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>
&lt;p&gt;&lt;b&gt;&lt;u&gt;Heelo&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
</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 !!!










share|improve this question














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>
&lt;p&gt;&lt;b&gt;&lt;u&gt;Heelo&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
</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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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












1 Answer
1






active

oldest

votes


















4














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






share|improve this answer


























  • 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











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
});


}
});














draft saved

draft discarded


















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









4














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






share|improve this answer


























  • 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
















4














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






share|improve this answer


























  • 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














4












4








4







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






share|improve this answer















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







share|improve this answer














share|improve this answer



share|improve this answer








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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas