[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] difficulties with exclude-result-prefixes and xsl:copy


Subject: Re: [xsl] difficulties with exclude-result-prefixes and xsl:copy
From: Amy Kaizerman <amy.j.kaizerman@xxxxxxxx>
Date: Wed, 08 Aug 2001 12:40:22 -0700

My XSL now looks like:

<xsl:template match="* | text() | @*">
  <xsl:copy>
    <xsl:apply-templates select="* | text() | @*"/>
  </xsl:copy>
</xsl:template>
<xsl:template match="/xql:result">
  <xsl:apply-templates select="*" />
</xsl:template>
<xsl:template match="/Aps:ProductStructure/@ino:id" />

and I'm still getting the same XML results.  What am I doing wrong?

Amy

Trevor Nash wrote:

> Amy,
>
> Your approach is right: you have the 'idenetity transform' which
> copies everything.
>
> Now just add templates to specify the differences:
>
> Get rid of xql:result, copying its children (i.e. the
> Apps:ProductStructure element) :-
>
> <xsl:template match="xql:result">
>   <xsl:apply-templates select="*" />
> </xsl:template>
>
> And delete the ino:id attribute:
>
> <xsl:template match="@ino:id" />
>
> Regards,
> Trevor Nash
>
> >
> >Hi.  I'm not sure how to do this the correct way.  I have the following XML:
> >
> ><xql:result>
> >  <Aps:ProductStructure ino:id='4' xmlns:Aps='http://www.foo.com/aps/' id='1'>
> >    <Aps:AssemblyName>bar</Aps:AssemblyName>
> >    <Aps:AlternateAssemblyName>testc</Aps:AlternateAssemblyName>
> >    <Aps:PartNumber>r20359</Aps:PartNumber>
> >    <Aps:Name>bar part 4</Aps:Name>
> >    <Aps:Description>this is just test data</Aps:Description>
> >    <Aps:PartRelationship>
> >      <Aps:PreviousAssembly id='0'>
> >        <Aps:Name>NSS-10 satellite</Aps:Name>
> >        <Aps:QuantityPreviousAssembly>1</Aps:QuantityPreviousAssembly>
> >      </Aps:PreviousAssembly>
> >      <Aps:Component id='2'>
> >        <Aps:Name>bolts</Aps:Name>
> >      </Aps:Component>
> >      <Aps:Component>
> >        <Aps:Name>nuts</Aps:Name>
> >      </Aps:Component>
> >    </Aps:PartRelationship>
> >    <Aps:AsBuilt>
> >    </Aps:AsBuilt>
> >  </Aps:ProductStructure>
> ></xql:result>
> >
> >And I want it returned to me exactly as it is without the <xql:result> tag and
> >the
> >attribute ino:id after Aps:ProductStructure.
> >
> >I thought I could just use the xsl:copy like so:
> >
> ><?xml version="1.0"?>
> ><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
> >xmlns:Aps="http://www.foo.com/aps/"
> >xmlns:ino="http://namespaces.softwareag.com/tamino/response2"
> >xmlns:xql="http://metalab.unc.edu/xql/"
> >exclude-result-prefixes="ino xql">
> >
> ><xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
> >
> ><xsl:template match="* | text() | @*">
> >  <xsl:copy>
> >    <xsl:apply-templates select="* | text() | @*"/>
> >  </xsl:copy>
> ></xsl:template>
> >
> ></xsl:stylesheet>
> >
> >but this gives me back exactly what I sent in.  I'm guessing xsl:copy doesn't
> >get rid of
> >the prefixes and does a straight copy.
> >
> >What is the easiset way for me to get back what I want?
> >
> >Thanks for any help you can give.
> >
> >Amy
> >
> >
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
> --
> Traditional training & distance learning,
> Consultancy by email
>
> Melvaig Software Engineering Limited
> voice:     +44 (0) 1445 771 271
> email:     tcn@xxxxxxxxxxxxx
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords