title: How can I use XSLT 2.0 and XSLT 3.0 in Java?
body: <p>I am able to use XSLT 1.0 in Java as shown in the folllowing example :-</p>
  
  <p>copy.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="identityxfm.xsl"?&gt;
  &lt;catalog&gt;
      &lt;book id="bk101"&gt;
          &lt;author&gt;Gambardella, Matthew&lt;/author&gt;
          &lt;title&gt;XML Developer's Guide&lt;/title&gt;
          &lt;genre&gt;Computer&lt;/genre&gt;
          &lt;price&gt;44.95&lt;/price&gt;
          &lt;publish_date&gt;2000-10-01&lt;/publish_date&gt;        
          &lt;description&gt;An in-depth look at creating applications with
   XML.&lt;/description&gt;
      &lt;/book&gt;
      &lt;book id="bk102"&gt;
          &lt;author&gt;Ralls, Kim&lt;/author&gt;
          &lt;title&gt;Midnight Rain&lt;/title&gt;
          &lt;genre&gt;Fantasy&lt;/genre&gt;
          &lt;price&gt;5.95&lt;/price&gt;
          &lt;publish_date&gt;2000-12-16&lt;/publish_date&gt;
          &lt;description&gt;A former architect battles corporate zombies,
   an evil sorceress, and her own childhood to become queen of the
   world.&lt;/description&gt;
      &lt;/book&gt;
      &lt;book id="bk103"&gt;
          &lt;author&gt;Corets, Eva&lt;/author&gt;
          &lt;title&gt;Maeve Ascendant&lt;/title&gt;
          &lt;genre&gt;Fantasy&lt;/genre&gt;
          &lt;price&gt;5.95&lt;/price&gt;
          &lt;publish_date&gt;2000-11-17&lt;/publish_date&gt;
          &lt;description&gt;After the collapse of a nanotechnology society
   in England, the young survivors lay the foundation for a new 
  society.&lt;/description&gt;
      &lt;/book&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>copy.xsl</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" &gt;
  
    &lt;xsl:template match="/ | @* | node()"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@* | node()"/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Copy.java</p>
  
  <pre><code>package com.data.transform;
  
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.stream.StreamResult;
  import javax.xml.transform.stream.StreamSource;
  
  public class Copy {
  
      public static void main(String args[]) throws Exception {
          StreamSource source = new StreamSource("copy.xml");
          StreamSource stylesource = new StreamSource("copy.xsl");
  
          TransformerFactory factory = TransformerFactory.newInstance();
          Transformer transformer = factory.newTransformer(stylesource);
  
          StreamResult result = new StreamResult(System.out);
          transformer.transform(source, result);
        }
  }
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;?xml-stylesheet type="text/xsl" href="identityxfm.xsl"?&gt;&lt;catalog&gt;
      &lt;book id="bk101"&gt;
          &lt;author&gt;Gambardella, Matthew&lt;/author&gt;
          &lt;title&gt;XML Developer's Guide&lt;/title&gt;
          &lt;genre&gt;Computer&lt;/genre&gt;
          &lt;price&gt;44.95&lt;/price&gt;
          &lt;publish_date&gt;2000-10-01&lt;/publish_date&gt;        
          &lt;description&gt;An in-depth look at creating applications with
   XML.&lt;/description&gt;
      &lt;/book&gt;
      &lt;book id="bk102"&gt;
          &lt;author&gt;Ralls, Kim&lt;/author&gt;
          &lt;title&gt;Midnight Rain&lt;/title&gt;
          &lt;genre&gt;Fantasy&lt;/genre&gt;
          &lt;price&gt;5.95&lt;/price&gt;
          &lt;publish_date&gt;2000-12-16&lt;/publish_date&gt;
          &lt;description&gt;A former architect battles corporate zombies,
   an evil sorceress, and her own childhood to become queen of the
   world.&lt;/description&gt;
      &lt;/book&gt;
      &lt;book id="bk103"&gt;
          &lt;author&gt;Corets, Eva&lt;/author&gt;
          &lt;title&gt;Maeve Ascendant&lt;/title&gt;
          &lt;genre&gt;Fantasy&lt;/genre&gt;
          &lt;price&gt;5.95&lt;/price&gt;
          &lt;publish_date&gt;2000-11-17&lt;/publish_date&gt;
          &lt;description&gt;After the collapse of a nanotechnology society
   in England, the young survivors lay the foundation for a new 
  society.&lt;/description&gt;
      &lt;/book&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>But, now I want to use few things that are included in XSLT 2.0 and XSLT 3.0 (like <code>xsl:analyze-string</code>, <code>xsl:try</code> etc.) in Java. How can I do that ?</p>