getAssociatedStylesheet()
wrapper = encapsuleur, emballeuse
core = coeur, base, noyau
xsl-list@lists.mulberrytech.com Mailing List Interface:
http://www.biglist.com/lists/xsl-list/archives/
Search the xsl-list@lists.mulberrytech.com Archives
B-Bop Xfinity Designer:
www.b-bop.com/products_xfinity_designer.htm
Xfinity Designer is a Visual XSL Stylesheet development tool for developers
to quickly and easily generate XSL stylesheets without becoming experts
at XSL and XPATH syntax.
Microsoft Windows 98, 2000, NT :-(
XML canonique: pas d'en-tête, ni de retour chariot.
[barkati@ceres sax]$ java sax.SAXWriter ../../data/personal.xml
[barkati@ceres sax]$ java sax.SAX2Writer ../../data/personal.xml
parser.setFeature(
"http://apache.org/xml/features/dom/defer-node-expansion",
setDeferredDOM );
parser.setFeature( "http://xml.org/sax/features/validation",
setValidation );
parser.setFeature( "http://xml.org/sax/features/namespaces",
setNameSpaces );
parser.setFeature( "http://apache.org/xml/features/validation/schema",
setSchemaSupport );
Document
document = parser.parse(uri);
DOMWriter writer = new DOMWriter(canonical);
writer.print(document);
if
( parser instanceof XMLReader ){
((XMLReader)parser).setFeature( "http://xml.org/sax/features/validation",
setValidation);
((XMLReader)parser).setFeature( "http://xml.org/sax/features/namespaces",
setNameSpaces );
((XMLReader)parser).setFeature( "http://apache.org/xml/features/validation/schema",
setSchemaSupport );
}
parser.setDocumentHandler(handler);
parser.setErrorHandler(handler);
parser.parse(uri);
parser.setFeature(
"http://xml.org/sax/features/validation",
setValidation);
parser.setFeature( "http://xml.org/sax/features/namespaces",
setNameSpaces );
parser.setFeature( "http://apache.org/xml/features/validation/schema",
setSchemaSupport );
parser.setContentHandler(handler);
parser.setErrorHandler(handler);
parser.parse(uri);
[barkati@ceres dom]$ java dom.DOMFilter -e family ../../data/personal.xml
../../data/personal.xml:
<family>
<family>
<family>
<family>
<family>
<family>
[barkati@ceres dom]$ java dom.DOMFilter -a subordinates ../../data/personal.xml
../../data/personal.xml:
<link subordinates="one.worker two.worker three.worker four.worker
five.worker">
[barkati@ceres traversal]$ java dom.traversal.IteratorView ../good.xml
import java.awt.*;
import java.awt.event.*;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import org.apache.xerces.parsers.*;
import org.w3c.dom.*;
import org.w3c.dom.traversal.*;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import ui.DOMTreeFull;
public class IteratorView
extends JFrame
implements ActionListener {
Document document;
TreeNode lastSelected;
DOMParser parser;
JTextArea messageText;
JScrollPane messageScroll;
DOMTreeFull jtree;
NodeIterator iterator;
NameNodeFilter nameNodeFilter;
iterator
= ((DocumentTraversal)document).
createNodeIterator(
document,
NodeFilter.SHOW_ALL,
new NameNodeFilter(),
true);
if (e.getSource() == nextButton)
{
Node node = iterator.nextNode();
if (e.getSource() == prevButton)
{
Node node = iterator.previousNode();
parent.removeChild(node);
Node
textNode = document.createTextNode(text);
node.appendChild(textNode);
[barkati@ceres barkati]$ tar xvzf xalan-j_1_2_2.tar.gz
It is compatible with Xerces 1.1.3
xerces-1_3_1
Acknowledgment: I have added the address
barkati@edite-de-paris.com.fr
to the xalan-dev mailing list.
file:/home/barkati/xalan-j_1_2_2/docs/overview.html
Xalan-Java uses a high-performance Document Table Model (DTM) to
parse XML documents and XSL stylesheets.
The input may appear in the form of a file, a character stream,
a byte stream, a DOM, or a SAX input stream.
Xalan-Java performs the transformations specified in the XSL stylesheet
and produces
a document file, a character stream, a byte stream, a DOM, or a series
of SAX events,
as you specify when you set up the transformation.
Résultat de la recherche pour le mot : embedded
scellé = embedded (adjectif, adverbe)
truc = embedded (adjectif, adverbe)
embedd* = embedded (n/a)
embarqué = embedded (adjectif, adverbe)
intégré = embedded (adjectif, adverbe)
scelle = embedded (n/a)
Acknowledgment: I have added the address
barkati@edite-de-paris.com.fr
to the announcements mailing list.
import org.apache.xalan.xslt.XSLTProcessor;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTResultTarget;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xpath.xml.TreeWalker;
import org.apache.xalan.xpath.xml.FormatterToXML;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.Reader;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
// Create an XSLT processor.
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
// Create input source documents.
XSLTInputSource xmlID = new XSLTInputSource("birds.xml");
XSLTInputSource stylesheetID = new XSLTInputSource("birds.xsl");
// Create a DOM Document node to attach the result
nodes to.
Document out = new org.apache.xerces.dom.DocumentImpl();
XSLTResultTarget resultTarget = new XSLTResultTarget(out);
// Process the source tree and produce the result
tree.
processor.process(xmlID, stylesheetID, resultTarget);
// Use the FormatterToXML and TreeWalker to print
the DOM to System.out
FormatterToXML fl = new FormatterToXML(new
FileOutputStream("birds.out"));
TreeWalker tw = new TreeWalker(fl);
tw.traverse(out);
[barkati@ceres UseStylesheetParam]$ java UseStylesheetParam aa
------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<out>aa</out>
------------------
foo.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="param1" select="'default value'"/>
<xsl:template match="doc">
<out><xsl:value-of select="$param1"/></out>
</xsl:template>
</xsl:stylesheet>
// Use the simple XPath API
to select a node.
nl = XPathAPI.selectNodeList(root,
xpath);
// Use the FormatterToXML
class right not instead of
// the Xerces Serializer
classes, because I'm not sure
// yet how to make them
handle arbitrary nodes.
FormatterToXML fl
= new FormatterToXML(System.out);
TreeWalker tw = new
TreeWalker(fl);
int n = nl.getLength();
for(int i = 0; i < n;
i++)
{
tw.traverse(nl.item(i));
// We have to
do both a flush and a flushWriter here,
// because the
FormatterToXML rightly does not flush
// until it
get's an endDocument, which usually will
// not happen
here.
fl.flush();
fl.flushWriter();
foo.xml:
<?xml version="1.0"?>
<doc>Hello</doc>
foo.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="doc">
<out><xsl:value-of select="."/></out>
</xsl:template>
</xsl:stylesheet>
foo2.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="out">
<out><xsl:value-of select="."/> ...and goodby!</out>
</xsl:template>
</xsl:stylesheet>
<?xml-stylesheet href="Vehicles.xsl" type="text/xsl"?> //in the XML
file
select=@attribute
<xsl:template match="Class">
<BirdInfo>
<xsl:apply-templates select="Order"/>
</BirdInfo>
</xsl:template>
<xsl:template match="Order">
Order is: <xsl:value-of select="@Name"/>
<xsl:apply-templates select="Family"/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="Family">
Family is: <xsl:value-of select="@Name"/>
<xsl:apply-templates select="Species | SubFamily | text()"/>
</xsl:template>
<xsl:template match="SubFamily">
SubFamily is <xsl:value-of select="@Name"/>
<xsl:apply-templates select="Species | text()"/>
</xsl:template>
<xsl:template match="Species">
<xsl:choose>
<xsl:when test="name(..)='SubFamily'">
<xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text><xsl:value-of select="@Scientific_Name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/><xsl:text> </xsl:text><xsl:value-of
select="@Scientific_Name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Objet:
Re: DOM tree
Date:
Thu, 31 May 2001 15:45:34 +0200 (CEST)
De:
René Jensen <lundeman@tbkol.dk>
Répondre-A:
xerces-j-user@xml.apache.org
A:
xerces-j-user@xml.apache.org
Références:
1
Citat manuel.paitreault@cnedi69.cnafmail.fr:
> Hi,
>
> I create a DOM tree with xerces from a XML file :
>
> DOMParser parser = new DOMParser();
> try
{
> parser.parse("file.xml");
> }
catch (SAXException se)
{
> se.printStackTrace();
> }
> Document RequeteXML = parser.getDocument();
> NodeList NL = RequeteXML.getElementsByTagName("Mot");
> etc .....................
>
> I do some works on this tree ... I add and remove Nodes etc ...
> btu I know, I'd like to make the reverse operation : I'd like
to transform
> my Domtree "Document RequeteXML" in a file "requeteXML.xml" on my
hard disk
> ... is it possible, and how can I do this ??
>
> thank you in advance !!
>
XMLSerializer mySerializer =
new XMLSerializer("SomeOutPutSource","SomeFormatter");
mySerializer.serialize(RequeteXML);
Check the javaDoc for further details
\\|//
(@ @)
-----oOOo-(_)-oOOo-----
René Jensen
lundeman@tbkol.dk
Acknowledgment: I have added the address
barkati@edite-de-paris.com.fr
to the announcements mailing list.