You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Patrick Moore <pa...@rioport.com> on 2001/03/10 02:31:16 UTC

RE: is there a way to exclude xml headers of the transform result ?

Try adding :

<xsl:output method="text" />

(See section 16 in the XSLT spec ) 

-Patrick Moore

> -----Original Message-----
> From: Charlie Wu [mailto:daydayup@pacbell.net]
> Sent: Friday, March 09, 2001 5:19 PM
> To: xalan-dev@xml.apache.org
> Subject: RE: is there a way to exclude xml headers of the transform
> result?
> 
> 
> btw.. the code i'm using is basically taken from SimpleTransform.java
> 
> thanks!
> 
> Charlie
> 
>     public static String transform(String xmlString, String xslFile)
>     {
> 
>         TransformerFactory transformerFactory =
> TransformerFactory.newInstance();
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         try {
>             // System.out.println("Current dir is
> "+System.getProperty("user.dir"));
>             Templates stylesheet = transformerFactory.newTemplates(
>                 new StreamSource( new FileInputStream( xslFile ) ) );
>             Transformer processor = stylesheet.newTransformer();
>             StreamSource source = new StreamSource( new
> StringBufferInputStream( xmlString ) );
>             StreamResult result = new StreamResult( baos );
>             processor.transform( source, result );
>         } catch (FileNotFoundException e) {
>             e.printStackTrace();
>             System.exit(-1);
>         } catch (TransformerConfigurationException e) {
>             e.printStackTrace();
>             System.exit(-1);
>         } catch (TransformerException e) {
>             e.printStackTrace();
>             System.exit(-1);
>         }
> 	return baos.toString();
>     }
> 
> > -----Original Message-----
> > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > Sent: Friday, March 09, 2001 5:16 PM
> > To: Xalan-Dev@Xml. Apache. Org
> > Subject: is there a way to exclude xml headers of the 
> transform result?
> >
> >
> > hi there:
> >
> > i can now have a complete xml files to anotehr xml file 
> using xslt (with
> > xalan)
> >
> > i'm wondering if i can supress the output xml file's headers?
> >
> > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> >
> > 	to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> >
> > Thanks!
> >
> > Charlie
> >
> 

RE: is there a way to exclude xml headers of the transform result ?

Posted by Charlie Wu <da...@pacbell.net>.
xerces i believe.. which comes with xalan-j.

> -----Original Message-----
> From: Larry Garfield [mailto:lgarfiel@students.depaul.edu]
> Sent: Friday, March 09, 2001 6:15 PM
> To: xalan-dev@xml.apache.org
> Subject: Re: is there a way to exclude xml headers of the transform
> result ?
>
>
> What engine are you using?  I came into this thread late, so you may have
> already said, but MSXML likes to insert extraneous xmlns attributes where
> they don't belong.
>
> Charlie Wu wrote:
>
> > If I set xsl:output to text it returns only text.. i.e.
> > it returns val instead of <b>val</b>
> >
> > if I set it to html it returns <b
> > xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>
> >
> > i have to have <b>val</b> for wahtever reason.. any ideas?
> >
> > Thanks
> >
> > Charlie
> >
> > > -----Original Message-----
> > > From: Patrick Moore [mailto:patrickm@rioport.com]
> > > Sent: Friday, March 09, 2001 5:31 PM
> > > To: 'xalan-dev@xml.apache.org'
> > > Subject: RE: is there a way to exclude xml headers of the transform
> > > result ?
> > >
> > >
> > > Try adding :
> > >
> > > <xsl:output method="text" />
> > >
> > > (See section 16 in the XSLT spec )
> > >
> > > -Patrick Moore
> > >
> > > > -----Original Message-----
> > > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > > Sent: Friday, March 09, 2001 5:19 PM
> > > > To: xalan-dev@xml.apache.org
> > > > Subject: RE: is there a way to exclude xml headers of the transform
> > > > result?
> > > >
> > > >
> > > > btw.. the code i'm using is basically taken from
> SimpleTransform.java
> > > >
> > > > thanks!
> > > >
> > > > Charlie
> > > >
> > > >     public static String transform(String xmlString, String xslFile)
> > > >     {
> > > >
> > > >         TransformerFactory transformerFactory =
> > > > TransformerFactory.newInstance();
> > > >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > > >         try {
> > > >             // System.out.println("Current dir is
> > > > "+System.getProperty("user.dir"));
> > > >             Templates stylesheet = transformerFactory.newTemplates(
> > > >                 new StreamSource( new
eInputStream( 
> xslFile ) ) );
> > > >             Transformer processor = stylesheet.newTransformer();
> > > >             StreamSource source = new StreamSource( new
> > > > StringBufferInputStream( xmlString ) );
> > > >             StreamResult result = new StreamResult( baos );
> > > >             processor.transform( source, result );
> > > >         } catch (FileNotFoundException e) {
> > > >             e.printStackTrace();
> > > >             System.exit(-1);
> > > >         } catch (TransformerConfigurationException e) {
> > > >             e.printStackTrace();
> > > >             System.exit(-1);
> > > >         } catch (TransformerException e) {
> > > >             e.printStackTrace();
> > > >             System.exit(-1);
> > > >         }
> > > >     return baos.toString();
> > > >     }
> > > >
> > > > > -----Original Message-----
> > > > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > > > Sent: Friday, March 09, 2001 5:16 PM
> > > > > To: Xalan-Dev@Xml. Apache. Org
> > > > > Subject: is there a way to exclude xml headers of the
> > > > transform result?
> > > > >
> > > > >
> > > > > hi there:
> > > > >
> > > > > i can now have a complete xml files to anotehr xml file
> > > > using xslt (with
> > > > > xalan)
> > > > >
> > > > > i'm wondering if i can supress the output xml file's headers?
> > > > >
> > > > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > > > >
> > > > >   to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Charlie
> > > > >
> > > >
> 
> --
> Larry Garfield
> lgarfiel@students.depaul.edu
> 
> Do you have a PalmOS Organizer?  Click here to add me to your 
> address book:
> http://signature.coola.com/?lgarfiel@students.depaul.edu
> 
> -- "If at first you don't succeed, skydiving isn't for you." :-)
>

>


Re: is there a way to exclude xml headers of the transform result ?

Posted by Larry Garfield <lg...@students.depaul.edu>.
What engine are you using?  I came into this thread late, so you may have
already said, but MSXML likes to insert extraneous xmlns attributes where
they don't belong.

Charlie Wu wrote:

> If I set xsl:output to text it returns only text.. i.e.
> it returns val instead of <b>val</b>
>
> if I set it to html it returns <b
> xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>
>
> i have to have <b>val</b> for wahtever reason.. any ideas?
>
> Thanks
>
> Charlie
>
> > -----Original Message-----
> > From: Patrick Moore [mailto:patrickm@rioport.com]
> > Sent: Friday, March 09, 2001 5:31 PM
> > To: 'xalan-dev@xml.apache.org'
> > Subject: RE: is there a way to exclude xml headers of the transform
> > result ?
> >
> >
> > Try adding :
> >
> > <xsl:output method="text" />
> >
> > (See section 16 in the XSLT spec )
> >
> > -Patrick Moore
> >
> > > -----Original Message-----
> > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > Sent: Friday, March 09, 2001 5:19 PM
> > > To: xalan-dev@xml.apache.org
> > > Subject: RE: is there a way to exclude xml headers of the transform
> > > result?
> > >
> > >
> > > btw.. the code i'm using is basically taken from SimpleTransform.java
> > >
> > > thanks!
> > >
> > > Charlie
> > >
> > >     public static String transform(String xmlString, String xslFile)
> > >     {
> > >
> > >         TransformerFactory transformerFactory =
> > > TransformerFactory.newInstance();
> > >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > >         try {
> > >             // System.out.println("Current dir is
> > > "+System.getProperty("user.dir"));
> > >             Templates stylesheet = transformerFactory.newTemplates(
> > >                 new StreamSource( new FileInputStream( xslFile ) ) );
> > >             Transformer processor = stylesheet.newTransformer();
> > >             StreamSource source = new StreamSource( new
> > > StringBufferInputStream( xmlString ) );
> > >             StreamResult result = new StreamResult( baos );
> > >             processor.transform( source, result );
> > >         } catch (FileNotFoundException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         } catch (TransformerConfigurationException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         } catch (TransformerException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         }
> > >     return baos.toString();
> > >     }
> > >
> > > > -----Original Message-----
> > > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > > Sent: Friday, March 09, 2001 5:16 PM
> > > > To: Xalan-Dev@Xml. Apache. Org
> > > > Subject: is there a way to exclude xml headers of the
> > > transform result?
> > > >
> > > >
> > > > hi there:
> > > >
> > > > i can now have a complete xml files to anotehr xml file
> > > using xslt (with
> > > > xalan)
> > > >
> > > > i'm wondering if i can supress the output xml file's headers?
> > > >
> > > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > > >
> > > >   to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > > >
> > > > Thanks!
> > > >
> > > > Charlie
> > > >
> > >

--
Larry Garfield
lgarfiel@students.depaul.edu

Do you have a PalmOS Organizer?  Click here to add me to your address book:
http://signature.coola.com/?lgarfiel@students.depaul.edu

-- "If at first you don't succeed, skydiving isn't for you." :-)



RE: is there a way to exclude xml headers of the transform result ?

Posted by Charlie Wu <da...@pacbell.net>.
this worked! thanks Cory!!!

Charlie

> -----Original Message-----
> From: Cory Isaacson (Compuflex) [mailto:cisaacson@compuflex.com]
> Sent: Friday, March 09, 2001 6:25 PM
> To: xalan-dev@xml.apache.org
> Subject: RE: is there a way to exclude xml headers of the transform
> result ?
> 
> 
> You can try this attribute in the xsl:stylesheet element:
> 
> exclude-result-prefixes="[your namespace prefix]"
> 
> Cory
> 
> -----Original Message-----
> From: Charlie Wu [mailto:daydayup@pacbell.net]
> Sent: Friday, March 09, 2001 5:48 PM
> To: xalan-dev@xml.apache.org
> Subject: RE: is there a way to exclude xml headers of the transform
> result ?
> 
> 
> If I set xsl:output to text it returns only text.. i.e.
> it returns val instead of <b>val</b>
> 
> if I set it to html it returns <b
> xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>
> 
> i have to have <b>val</b> for wahtever reason.. any ideas?
> 
> Thanks
> 
> Charlie
> 
> > -----Original Message-----
> > From: Patrick Moore [mailto:patrickm@rioport.com]
> > Sent: Friday, March 09, 2001 5:31 PM
> > To: 'xalan-dev@xml.apache.org'
> > Subject: RE: is there a way to exclude xml headers of the transform
> > result ?
> >
> >
> > Try adding :
> >
> > <xsl:output method="text" />
> >
> > (See section 16 in the XSLT spec )
> >
> > -Patrick Moore
> >
> > > -----Original Message-----
> > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > Sent: Friday, March 09, 2001 5:19 PM
> > > To: xalan-dev@xml.apache.org
> > > Subject: RE: is there a way to exclude xml headers of the transform
> > > result?
> > >
> > >
> > > btw.. the code i'm using is basically taken from SimpleTransform.java
> > >
> > > thanks!
> > >
> > > Charlie
> > >
> > >     public static String transform(String xmlString, String xslFile)
> > >     {
> > >
> > >         TransformerFactory transformerFactory =
> > > TransformerFactory.newInstance();
> > >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > >         try {
> > >             // System.out.println("Current dir is
> > > "+System.getProperty("user.dir"));
> > >             Templates stylesheet = transformerFactory.newTemplates(
> > >                 new StreamSource( new FileInputStream( xslFile ) ) );
> > >             Transformer processor = stylesheet.newTransformer();
> > >             StreamSource source = new StreamSource( new
> > > StringBufferInputStream( xmlString ) );
> > >             StreamResult result = new StreamResult( baos );
> > >             processor.transform( source, result );
> > >         } catch (FileNotFoundException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         } catch (TransformerConfigurationException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         } catch (TransformerException e) {
> > >             e.printStackTrace();
> > >             System.exit(-1);
> > >         }
> > > 	return baos.toString();
> > >     }
> > >
> > > > -----Original Message-----
> > > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > > Sent: Friday, March 09, 2001 5:16 PM
> > > > To: Xalan-Dev@Xml. Apache. Org
> > > > Subject: is there a way to exclude xml headers of the
> > > transform result?
> > > >
> > > >
> > > > hi there:
> > > >
> > > > i can now have a complete xml files to anotehr xml file
> > > using xslt (with
> > > > xalan)
> > > >
> > > > i'm wondering if i can supress the output xml file's headers?
> > > >
> > > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > > >
> > > > 	to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > > >
> > > > Thanks!
> > > >
> > > > Charlie
> > > >
> > >
> 

RE: is there a way to exclude xml headers of the transform result ?

Posted by "Cory Isaacson (Compuflex)" <ci...@compuflex.com>.
You can try this attribute in the xsl:stylesheet element:

exclude-result-prefixes="[your namespace prefix]"

Cory

-----Original Message-----
From: Charlie Wu [mailto:daydayup@pacbell.net]
Sent: Friday, March 09, 2001 5:48 PM
To: xalan-dev@xml.apache.org
Subject: RE: is there a way to exclude xml headers of the transform
result ?


If I set xsl:output to text it returns only text.. i.e.
it returns val instead of <b>val</b>

if I set it to html it returns <b
xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>

i have to have <b>val</b> for wahtever reason.. any ideas?

Thanks

Charlie

> -----Original Message-----
> From: Patrick Moore [mailto:patrickm@rioport.com]
> Sent: Friday, March 09, 2001 5:31 PM
> To: 'xalan-dev@xml.apache.org'
> Subject: RE: is there a way to exclude xml headers of the transform
> result ?
>
>
> Try adding :
>
> <xsl:output method="text" />
>
> (See section 16 in the XSLT spec )
>
> -Patrick Moore
>
> > -----Original Message-----
> > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > Sent: Friday, March 09, 2001 5:19 PM
> > To: xalan-dev@xml.apache.org
> > Subject: RE: is there a way to exclude xml headers of the transform
> > result?
> >
> >
> > btw.. the code i'm using is basically taken from SimpleTransform.java
> >
> > thanks!
> >
> > Charlie
> >
> >     public static String transform(String xmlString, String xslFile)
> >     {
> >
> >         TransformerFactory transformerFactory =
> > TransformerFactory.newInstance();
> >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> >         try {
> >             // System.out.println("Current dir is
> > "+System.getProperty("user.dir"));
> >             Templates stylesheet = transformerFactory.newTemplates(
> >                 new StreamSource( new FileInputStream( xslFile ) ) );
> >             Transformer processor = stylesheet.newTransformer();
> >             StreamSource source = new StreamSource( new
> > StringBufferInputStream( xmlString ) );
> >             StreamResult result = new StreamResult( baos );
> >             processor.transform( source, result );
> >         } catch (FileNotFoundException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerConfigurationException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         }
> > 	return baos.toString();
> >     }
> >
> > > -----Original Message-----
> > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > Sent: Friday, March 09, 2001 5:16 PM
> > > To: Xalan-Dev@Xml. Apache. Org
> > > Subject: is there a way to exclude xml headers of the
> > transform result?
> > >
> > >
> > > hi there:
> > >
> > > i can now have a complete xml files to anotehr xml file
> > using xslt (with
> > > xalan)
> > >
> > > i'm wondering if i can supress the output xml file's headers?
> > >
> > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > >
> > > 	to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > >
> > > Thanks!
> > >
> > > Charlie
> > >
> >


RE: is there a way to exclude xml headers of the transform result ?

Posted by "Cory Isaacson (Compuflex)" <ci...@compuflex.com>.
You can try this in the <xsl:stylesheet> element:


-----Original Message-----
From: Charlie Wu [mailto:daydayup@pacbell.net]
Sent: Friday, March 09, 2001 5:48 PM
To: xalan-dev@xml.apache.org
Subject: RE: is there a way to exclude xml headers of the transform
result ?


If I set xsl:output to text it returns only text.. i.e.
it returns val instead of <b>val</b>

if I set it to html it returns <b
xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>

i have to have <b>val</b> for wahtever reason.. any ideas?

Thanks

Charlie

> -----Original Message-----
> From: Patrick Moore [mailto:patrickm@rioport.com]
> Sent: Friday, March 09, 2001 5:31 PM
> To: 'xalan-dev@xml.apache.org'
> Subject: RE: is there a way to exclude xml headers of the transform
> result ?
>
>
> Try adding :
>
> <xsl:output method="text" />
>
> (See section 16 in the XSLT spec )
>
> -Patrick Moore
>
> > -----Original Message-----
> > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > Sent: Friday, March 09, 2001 5:19 PM
> > To: xalan-dev@xml.apache.org
> > Subject: RE: is there a way to exclude xml headers of the transform
> > result?
> >
> >
> > btw.. the code i'm using is basically taken from SimpleTransform.java
> >
> > thanks!
> >
> > Charlie
> >
> >     public static String transform(String xmlString, String xslFile)
> >     {
> >
> >         TransformerFactory transformerFactory =
> > TransformerFactory.newInstance();
> >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> >         try {
> >             // System.out.println("Current dir is
> > "+System.getProperty("user.dir"));
> >             Templates stylesheet = transformerFactory.newTemplates(
> >                 new StreamSource( new FileInputStream( xslFile ) ) );
> >             Transformer processor = stylesheet.newTransformer();
> >             StreamSource source = new StreamSource( new
> > StringBufferInputStream( xmlString ) );
> >             StreamResult result = new StreamResult( baos );
> >             processor.transform( source, result );
> >         } catch (FileNotFoundException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerConfigurationException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         }
> > 	return baos.toString();
> >     }
> >
> > > -----Original Message-----
> > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > Sent: Friday, March 09, 2001 5:16 PM
> > > To: Xalan-Dev@Xml. Apache. Org
> > > Subject: is there a way to exclude xml headers of the
> > transform result?
> > >
> > >
> > > hi there:
> > >
> > > i can now have a complete xml files to anotehr xml file
> > using xslt (with
> > > xalan)
> > >
> > > i'm wondering if i can supress the output xml file's headers?
> > >
> > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > >
> > > 	to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > >
> > > Thanks!
> > >
> > > Charlie
> > >
> >


RE: is there a way to exclude xml headers of the transform result ?

Posted by Charlie Wu <da...@pacbell.net>.
If I set xsl:output to text it returns only text.. i.e.
it returns val instead of <b>val</b>

if I set it to html it returns <b
xmlns:fo="http://www.w3.org/1999/XSL/Format">val</b>

i have to have <b>val</b> for wahtever reason.. any ideas?

Thanks

Charlie

> -----Original Message-----
> From: Patrick Moore [mailto:patrickm@rioport.com]
> Sent: Friday, March 09, 2001 5:31 PM
> To: 'xalan-dev@xml.apache.org'
> Subject: RE: is there a way to exclude xml headers of the transform
> result ?
>
>
> Try adding :
>
> <xsl:output method="text" />
>
> (See section 16 in the XSLT spec )
>
> -Patrick Moore
>
> > -----Original Message-----
> > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > Sent: Friday, March 09, 2001 5:19 PM
> > To: xalan-dev@xml.apache.org
> > Subject: RE: is there a way to exclude xml headers of the transform
> > result?
> >
> >
> > btw.. the code i'm using is basically taken from SimpleTransform.java
> >
> > thanks!
> >
> > Charlie
> >
> >     public static String transform(String xmlString, String xslFile)
> >     {
> >
> >         TransformerFactory transformerFactory =
> > TransformerFactory.newInstance();
> >         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> >         try {
> >             // System.out.println("Current dir is
> > "+System.getProperty("user.dir"));
> >             Templates stylesheet = transformerFactory.newTemplates(
> >                 new StreamSource( new FileInputStream( xslFile ) ) );
> >             Transformer processor = stylesheet.newTransformer();
> >             StreamSource source = new StreamSource( new
> > StringBufferInputStream( xmlString ) );
> >             StreamResult result = new StreamResult( baos );
> >             processor.transform( source, result );
> >         } catch (FileNotFoundException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerConfigurationException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         } catch (TransformerException e) {
> >             e.printStackTrace();
> >             System.exit(-1);
> >         }
> > 	return baos.toString();
> >     }
> >
> > > -----Original Message-----
> > > From: Charlie Wu [mailto:daydayup@pacbell.net]
> > > Sent: Friday, March 09, 2001 5:16 PM
> > > To: Xalan-Dev@Xml. Apache. Org
> > > Subject: is there a way to exclude xml headers of the
> > transform result?
> > >
> > >
> > > hi there:
> > >
> > > i can now have a complete xml files to anotehr xml file
> > using xslt (with
> > > xalan)
> > >
> > > i'm wondering if i can supress the output xml file's headers?
> > >
> > > i.e. from: <a>val</a> (or <?xml version="1.0"?><a>val</a>)
> > >
> > > 	to: <b>val</b> (not <?xml version="1.0"?><b>val</b>)
> > >
> > > Thanks!
> > >
> > > Charlie
> > >
> >