Re: [xslt] Trouble printing xmlns: attribute in name space.
- From: sudhakar+xslt CS Princeton EDU
- To: Daniel Veillard <veillard redhat com>
- Cc: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] Trouble printing xmlns: attribute in name space.
- Date: Sun, 16 Jan 2005 17:23:09 -0500 (EST)
thanks Daniel. I visited the page you sent. That seems a more
appropriate place for some questions. The FAQ answered some of my
questions I wanted to ask on this list. :-) Anyway, your reply did not
answer my question. Can you clarify it? Please read my explanation below.
On Thu, 13 Jan 2005, Daniel Veillard wrote:
> On Wed, Jan 12, 2005 at 12:48:00PM -0500, sudhakar+xslt CS Princeton EDU wrote:
> > <xsl:element name="oval" namespace="http://oval.mitre.org/XMLSchema/oval">
> > <xsl:attribute name="xmlns:oval">
> > http://oval.mitre.org/XMLSchema/oval
> > </xsl:attribute>
> > </xsl:element>
> >
> >
> > I get this output:
> >
> > <oval xmlns="http://oval.mitre.org/XMLSchema/oval">
>
> Normal.
> Namespaces are NOT attributes in the XPath data model.
>
> >
> > The xmlns:oval is just deleted. I referred the documentation at
> >
> > http://www.w3.org/TR/xslt#creating-attributes
> >
> > It does not say how to do it. It just says that the declaration will not
> > be output. Docs:
>
> The XSLT processor will output all namespaces in scope at the place
> of the command in the XSLT. Put the namespaces in the XSLT stylesheet.
Can you tell me how to do this? I could not figure out how to do it?
Sorry, I am newbie and kind of completely lost on this one. The files are
at:
http://www.cs.princeton.edu/~sudhakar/scratch/xml/gnome/sunday-question
good.xsl is the style sheet with a bad hack (escaping the <> characters
to generate) to generate the good.output
Without the hack, I am not able to print the namespace attributes. See the
file bad.xsl and bad.output. The oval node misses all the namespace
attributes.
The question is how to avoid the silly hack I did in good.xsl file. The
input file dummy.definitions.xml is not used in the stylesheets.
Sudhakar.
PS: Attached the files too.
>
> > PS: Am I asking too dumb questions? Please let me know if these questions
> > are inappropriate for the list.
>
> Dumb, no. Inappropriate, kind of, since they are purely generic XSLT
> questions and not specific to libxslt itself. This mean you may or may
> not get answers from the list users, while you have more chances to have
> and answer from a dedicated source.
> http://xmlsoft.org/XSLT/bugs.html
> lists such dedicated XSLT resources.
>
> Daniel
>
> --
> Daniel Veillard | Red Hat Desktop team http://redhat.com/
> veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
>
Sudhakar.
Sudhakar Govindavajhala Department of Computer Science
Graduate Student, Princeton University
Ph : (lab) +1 609 258 1763 (office) +1 609 258 1798
http://www.cs.princeton.edu/~sudhakar
<?xml version="1.0"?>
<oval xmlns="http://oval.mitre.org/XMLSchema/oval">
<definitions>
test
</definitions>
</oval>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oval="http://oval.mitre.org/XMLSchema/oval"
xmlns:system_characteristics="http://oval.mitre.org/XMLSchema/system_characteristics"
xmlns:oval_results="http://oval.mitre.org/XMLSchema/oval_results"
xmlns:sc_redhat="http://oval.mitre.org/XMLSchema/system_characteristics#redhat"
xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat"
>
<xsl:output method="xml" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*">
<xsl:element name="oval" xmlns="http://oval.mitre.org/XMLSchema/oval" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oval="http://oval.mitre.org/XMLSchema/oval" xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval oval-schema.xsd http://oval.mitre.org/XMLSchema/oval#redhat redhat-schema.xsd" oval:schemaVersion="3.0" redhat:schemaVersion="3.0" oval:timeStamp="20041215153824" >
<xsl:call-template name="newline"/>
<xsl:element name="definitions">
test <xsl:call-template name="newline"/>
</xsl:element>
<xsl:call-template name="newline"/>
</xsl:element>
</xsl:template>
<xsl:template name="newline">
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<oval xmlns="http://oval.mitre.org/XMLSchema/oval" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oval="http://oval.mitre.org/XMLSchema/oval" xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval oval-schema.xsd http://oval.mitre.org/XMLSchema/oval#redhat redhat-schema.xsd" oval:schemaVersion="3.0" redhat:schemaVersion="3.0" oval:timeStamp="20041215153824" >
<definitions>
test
</definitions>
</oval>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oval="http://oval.mitre.org/XMLSchema/oval"
xmlns:system_characteristics="http://oval.mitre.org/XMLSchema/system_characteristics"
xmlns:oval_results="http://oval.mitre.org/XMLSchema/oval_results"
xmlns:sc_redhat="http://oval.mitre.org/XMLSchema/system_characteristics#redhat"
xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat"
>
<xsl:output method="xml" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*">
<xsl:text disable-output-escaping='yes'><oval xmlns="http://oval.mitre.org/XMLSchema/oval" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oval="http://oval.mitre.org/XMLSchema/oval" xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval oval-schema.xsd http://oval.mitre.org/XMLSchema/oval#redhat redhat-schema.xsd" oval:schemaVersion="3.0" redhat:schemaVersion="3.0" oval:timeStamp="20041215153824" ></xsl:text>
<xsl:call-template name="newline"/>
<xsl:element name="definitions">
test <xsl:call-template name="newline"/>
</xsl:element>
<xsl:call-template name="newline"/>
<xsl:text disable-output-escaping='yes'></oval></xsl:text>
</xsl:template>
<xsl:template name="newline">
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="transform.xsl"?>
<!-- This is a dummy test. Used by genAttribDef.xsl to generate modified redhat.definitions.xml to get file attributes for each permission test -->
<oval xmlns="http://oval.mitre.org/XMLSchema/oval" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oval="http://oval.mitre.org/XMLSchema/oval" xmlns:redhat="http://oval.mitre.org/XMLSchema/oval#redhat" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval oval-schema.xsd http://oval.mitre.org/XMLSchema/oval#redhat redhat-schema.xsd" oval:schemaVersion="3.0" redhat:schemaVersion="3.0" oval:timeStamp="20041215153824">
<definitions>
<definition id="OVAL1" class="vulnerability">
<affected family="redhat">
<redhat:platform>Red Hat Enterprise Linux 3</redhat:platform>
<product>Linux kernel</product>
</affected>
<contributors>
<submitter organization="Dummy Corporation">Sudhakar</submitter>
</contributors>
<cveid status="CAN">2004-0495</cveid>
<dates>
<created date="2004-09-02"/>
</dates>
<description>Dummy</description>
<status>ACCEPTED</status>
<version>1</version>
<criteria>
<software operation="AND">
<criterion test_ref="rut-201" comment="dummy uname test" />
</software>
</criteria>
</definition>
</definitions>
<tests>
<uname_test id="rut-201" comment="ix86 architecture" xmlns="http://oval.mitre.org/XMLSchema/oval#redhat">
<machine_class operator="pattern match">.*</machine_class>
</uname_test>
</tests>
</oval>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]