Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2007, 07:45 PM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Default attributes from DTD while transformation

When I transform XML, XSLT automatically adds extra attributes to the node which are declared in DTD (default DTD attributes) . I just want XSLT not to add these extra default attributes from DTD while transformation.

See refname and shortname attributes are automatically added to node after transformation.

Please let me know how to fix this.
 
Old March 26th, 2007, 07:46 PM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please find source XML, XSLT and transformed XML respectively.

----------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ONIXMessage SYSTEM "http://www.editeur.org/onix/2.1/reference/onix-international.dtd">
<ONIXMessage>
  <Header>
    <FromEANNumber>5013546111661</FromEANNumber>
    <FromCompany>NielsenBookData</FromCompany>
    <FromPerson>Angela Kendall</FromPerson>
    <FromEmail>[email protected]</FromEmail>
    <SentDate>20061213</SentDate>
    <DefaultLanguageOfText>eng</DefaultLanguageOfText>
  </Header>
  <Product>
    <RecordReference>9780643091610</RecordReference>
    <NotificationType>03</NotificationType>
    <RecordSourceType>04</RecordSourceType>
    <RecordSourceName>Nielsen BookData</RecordSourceName>
    <RecordSourceIdentifierType>02</RecordSourceIdentifierType>
    <RecordSourceIdentifier>NBD</RecordSourceIdentifier>
    <ProductIdentifier>
      <ProductIDType>15</ProductIDType>
      <IDValue>9780643091610</IDValue>
    </ProductIdentifier>
    <ProductForm>BB</ProductForm>
    <Title>
      <TitleType>01</TitleType>
      <TitleText>The Nature of Plants</TitleText>
      <TitlePrefix>The</TitlePrefix>
      <TitleWithoutPrefix>Nature of Plants</TitleWithoutPrefix>
      <Subtitle>Habitats, Challenges and Adaptations</Subtitle>
    </Title>
    <Contributor>
      <SequenceNumber>1</SequenceNumber>
      <ContributorRole>A01</ContributorRole>
      <PersonName>John Dawson</PersonName>
      <PersonNameInverted>Dawson, John</PersonNameInverted>
      <NamesBeforeKey>John</NamesBeforeKey>
      <KeyNames>Dawson</KeyNames>
    </Contributor>
    <Contributor>
      <SequenceNumber>2</SequenceNumber>
      <ContributorRole>A01</ContributorRole>
      <PersonName>Rob Lucas</PersonName>
      <PersonNameInverted>Lucas, Rob</PersonNameInverted>
      <NamesBeforeKey>Rob</NamesBeforeKey>
      <KeyNames>Lucas</KeyNames>
    </Contributor>
    <EditionStatement>New title</EditionStatement>
    <NumberOfPages>314</NumberOfPages>
    <IllustrationsNote>colour photos &amp; illus</IllustrationsNote>
    <BASICMainSubject>GAR000000</BASICMainSubject>
    <BASICVersion>BISAC V2.8</BASICVersion>
    <BICMainSubject>VG</BICMainSubject>
    <BICVersion>1.1</BICVersion>
    <Subject>
      <SubjectSchemeIdentifier>01</SubjectSchemeIdentifier>
      <SubjectSchemeVersion>DC21</SubjectSchemeVersion>
      <SubjectCode>635</SubjectCode>
    </Subject>
    <AudienceCode>01</AudienceCode>
    <AudienceCode>05</AudienceCode>
    <OtherText>
      <TextTypeCode>02</TextTypeCode>
      <Text>There has always been interest in how animals live their lives - it is easy for us to identify with them. But there are many remarkable stories about plants that deserve to be told. This book tells how plants adapt to the challenges of their habitats.</Text>
    </OtherText>
    <Imprint>
      <NameCodeType>02</NameCodeType>
      <NameCodeTypeName>Nielsen BookData Org ID</NameCodeTypeName>
      <NameCodeValue>110001</NameCodeValue>
      <ImprintName>CSIRO Publishing</ImprintName>
    </Imprint>
    <Publisher>
      <NameCodeType>02</NameCodeType>
      <NameCodeTypeName>Nielsen BookData Org ID</NameCodeTypeName>
      <NameCodeValue>110001</NameCodeValue>
      <PublisherName>CSIRO Publishing</PublisherName>
    </Publisher>
    <CityOfPublication>Melbourne</CityOfPublication>
    <CountryOfPublication>AU</CountryOfPublication>
    <PublishingStatus>04</PublishingStatus>
    <PublicationDate>20050301</PublicationDate>
    <SalesRights>
      <SalesRightsType>02</SalesRightsType>
      <RightsCountry>AU NZ</RightsCountry>
    </SalesRights>
    <Measure>
      <MeasureTypeCode>01</MeasureTypeCode>
      <Measurement>260</Measurement>
      <MeasureUnitCode>mm</MeasureUnitCode>
    </Measure>
    <Measure>
      <MeasureTypeCode>02</MeasureTypeCode>
      <Measurement>185</Measurement>
      <MeasureUnitCode>mm</MeasureUnitCode>
    </Measure>
    <Measure>
      <MeasureTypeCode>08</MeasureTypeCode>
      <Measurement>1180</Measurement>
      <MeasureUnitCode>gr</MeasureUnitCode>
    </Measure>
    <SupplyDetail>
      <SupplierName>Supplier Unknown</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>GB</SupplyToCountry>
      <ProductAvailability>43</ProductAvailability>
      <Price>
        <PriceTypeCode>02</PriceTypeCode>
        <PriceAmount>0.50</PriceAmount>
        <CurrencyCode>GBP</CurrencyCode>
        <TaxRateCode1>Z</TaxRateCode1>
        <TaxRatePercent1>0.0</TaxRatePercent1>
        <TaxableAmount1>0.50</TaxableAmount1>
        <TaxAmount1>0.00</TaxAmount1>
      </Price>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>72077</IDValue>
      </SupplierIdentifier>
      <SupplierName>Eurospan Group Ltd</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>GB</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>117189</IDValue>
      </SupplierIdentifier>
      <SupplierName>Antipodes Books and Beyond</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>US</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>120778</IDValue>
      </SupplierIdentifier>
      <SupplierName>CSIRO Publishing</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>AU</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>114396</IDValue>
      </SupplierIdentifier>
      <SupplierName>University and Reference Publishers' Services (UNIREPS)</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>AU</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>123799</IDValue>
      </SupplierIdentifier>
      <SupplierName>Manaaki Whenua Press</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>NZ</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>114396</IDValue>
      </SupplierIdentifier>
      <SupplierName>University and Reference Publishers' Services (UNIREPS)</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>NZ</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier>
        <SupplierIDType>02</SupplierIDType>
        <IDTypeName>Nielsen BookData Org ID</IDTypeName>
        <IDValue>72077</IDValue>
      </SupplierIdentifier>
      <SupplierName>Eurospan Group Ltd</SupplierName>
      <SupplierRole>00</SupplierRole>
      <SupplyToCountry>IE</SupplyToCountry>
      <ProductAvailability>99</ProductAvailability>
      <UnpricedItemType>04</UnpricedItemType>
    </SupplyDetail>
    <MarketRepresentation>
      <AgentName>University and Reference Publishers' Services (UNIREPS)</AgentName>
      <AgentRole>07</AgentRole>
      <MarketCountry>AU</MarketCountry>
    </MarketRepresentation>
  </Product>
  <Product>
</ONIXMessage>

-------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" indent="yes"/>
    <xsl:output doctype-system="http://www.editeur.org/onix/2.1/reference/onix-international.dtd"/>

    <xsl:template match="/">
        <xsl:comment>Transformed by ONIX Loader to make this valid XML file</xsl:comment>

        <ONIXMessage>
            <Header>
                <xsl:apply-templates select="ONIXMessage/Header/node()"/>
            </Header>

            <xsl:apply-templates select="ONIXMessage/Product"/>
        </ONIXMessage>
    </xsl:template>

    <xsl:template match="Product">
        <Product>
            <xsl:apply-templates select="RecordReference"/>
            <xsl:apply-templates select="NotificationType"/>
            <xsl:apply-templates select="RecordSourceType"/>
            <xsl:apply-templates select="RecordSourceIdentifierType"/>
            <xsl:apply-templates select="RecordSourceIdentifier"/>
            <xsl:apply-templates select="RecordSourceName"/>

            <xsl:apply-templates select="node()
                [
                name(.) != 'RecordReference'
                and name(.) != 'NotificationType'
                and name(.) != 'RecordSourceType'
                and name(.) != 'RecordSourceIdentifierType'
                and name(.) != 'RecordSourceIdentifier'
                and name(.) != 'RecordSourceName'
                ]"/>
        </Product>
    </xsl:template>

    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="node()"/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>
--------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!--Transformed by ONIX Loader to make this valid XML file->
<!DOCTYPE ONIXMessage SYSTEM "http://www.editeur.org/onix/2.1/reference/onix-international.dtd">
<ONIXMessage>
  <Header>
    <FromEANNumber>5013546111661</FromEANNumber>
    <FromCompany>NielsenBookData</FromCompany>
    <FromPerson>Angela Kendall</FromPerson>
    <FromEmail>[email protected]</FromEmail>
    <SentDate>20061213</SentDate>
    <DefaultLanguageOfText>eng</DefaultLanguageOfText>
  </Header>
  <Product>
    <RecordReference>9780643091610</RecordReference>
    <NotificationType>03</NotificationType>
    <RecordSourceType>04</RecordSourceType>
    <RecordSourceIdentifierType>02</RecordSourceIdentifierType>
    <RecordSourceIdentifier>NBD</RecordSourceIdentifier>
    <RecordSourceName>Nielsen BookData</RecordSourceName>
    <ProductIdentifier>
      <ProductIDType refname="ProductIDType" shortname="b221">15</ProductIDType>
      <IDValue refname="IDValue" shortname="b244">9780643091610</IDValue>
    </ProductIdentifier>
    <ProductForm>BB</ProductForm>
    <Title>
      <TitleType refname="TitleType" shortname="b202">01</TitleType>
      <TitleText refname="TitleText" shortname="b203">The Nature of Plants</TitleText>
      <TitlePrefix refname="TitlePrefix" shortname="b030">The</TitlePrefix>
      <TitleWithoutPrefix refname="TitleWithoutPrefix" shortname="b031">Nature of Plants</TitleWithoutPrefix>
      <Subtitle refname="Subtitle" shortname="b029">Habitats, Challenges and Adaptations</Subtitle>
    </Title>
    <Contributor>
      <SequenceNumber refname="SequenceNumber" shortname="b034">1</SequenceNumber>
      <ContributorRole refname="ContributorRole" shortname="b035">A01</ContributorRole>
      <PersonName refname="PersonName" shortname="b036">John Dawson</PersonName>
      <PersonNameInverted refname="PersonNameInverted" shortname="b037">Dawson, John</PersonNameInverted>
      <NamesBeforeKey refname="NamesBeforeKey" shortname="b039">John</NamesBeforeKey>
      <KeyNames refname="KeyNames" shortname="b040">Dawson</KeyNames>
    </Contributor>
    <Contributor>
      <SequenceNumber refname="SequenceNumber" shortname="b034">2</SequenceNumber>
      <ContributorRole refname="ContributorRole" shortname="b035">A01</ContributorRole>
      <PersonName refname="PersonName" shortname="b036">Rob Lucas</PersonName>
      <PersonNameInverted refname="PersonNameInverted" shortname="b037">Lucas, Rob</PersonNameInverted>
      <NamesBeforeKey refname="NamesBeforeKey" shortname="b039">Rob</NamesBeforeKey>
      <KeyNames refname="KeyNames" shortname="b040">Lucas</KeyNames>
    </Contributor>
    <EditionStatement>New title</EditionStatement>
    <NumberOfPages>314</NumberOfPages>
    <IllustrationsNote>colour photos &amp; illus</IllustrationsNote>
    <BASICMainSubject>GAR000000</BASICMainSubject>
    <BASICVersion>BISAC V2.8</BASICVersion>
    <BICMainSubject>VG</BICMainSubject>
    <BICVersion>1.1</BICVersion>
    <Subject>
      <SubjectSchemeIdentifier refname="SubjectSchemeIdentifier" shortname="b067">01</SubjectSchemeIdentifier>
      <SubjectSchemeVersion refname="SubjectSchemeVersion" shortname="b068">DC21</SubjectSchemeVersion>
      <SubjectCode refname="SubjectCode" shortname="b069">635</SubjectCode>
    </Subject>
    <AudienceCode>01</AudienceCode>
    <AudienceCode>05</AudienceCode>
    <OtherText>
      <TextTypeCode refname="TextTypeCode" shortname="d102">02</TextTypeCode>
      <Text refname="Text" shortname="d104">There has always been interest in how animals live their lives - it is easy for us to identify with them. But there are many remarkable stories about plants that deserve to be told. This book tells how plants adapt to the challenges of their habitats.</Text>
    </OtherText>
    <Imprint>
      <NameCodeType refname="NameCodeType" shortname="b241">02</NameCodeType>
      <NameCodeTypeName refname="NameCodeTypeName" shortname="b242">Nielsen BookData Org ID</NameCodeTypeName>
      <NameCodeValue refname="NameCodeValue" shortname="b243">110001</NameCodeValue>
      <ImprintName refname="ImprintName" shortname="b079">CSIRO Publishing</ImprintName>
    </Imprint>
    <Publisher>
      <NameCodeType refname="NameCodeType" shortname="b241">02</NameCodeType>
      <NameCodeTypeName refname="NameCodeTypeName" shortname="b242">Nielsen BookData Org ID</NameCodeTypeName>
      <NameCodeValue refname="NameCodeValue" shortname="b243">110001</NameCodeValue>
      <PublisherName refname="PublisherName" shortname="b081">CSIRO Publishing</PublisherName>
    </Publisher>
    <CityOfPublication>Melbourne</CityOfPublication>
    <CountryOfPublication>AU</CountryOfPublication>
    <PublishingStatus>04</PublishingStatus>
    <PublicationDate>20050301</PublicationDate>
    <SalesRights>
      <SalesRightsType refname="SalesRightsType" shortname="b089">02</SalesRightsType>
      <RightsCountry refname="RightsCountry" shortname="b090">AU NZ</RightsCountry>
    </SalesRights>
    <Measure>
      <MeasureTypeCode refname="MeasureTypeCode" shortname="c093">01</MeasureTypeCode>
      <Measurement refname="Measurement" shortname="c094">260</Measurement>
      <MeasureUnitCode refname="MeasureUnitCode" shortname="c095">mm</MeasureUnitCode>
    </Measure>
    <Measure>
      <MeasureTypeCode refname="MeasureTypeCode" shortname="c093">02</MeasureTypeCode>
      <Measurement refname="Measurement" shortname="c094">185</Measurement>
      <MeasureUnitCode refname="MeasureUnitCode" shortname="c095">mm</MeasureUnitCode>
    </Measure>
    <Measure>
      <MeasureTypeCode refname="MeasureTypeCode" shortname="c093">08</MeasureTypeCode>
      <Measurement refname="Measurement" shortname="c094">1180</Measurement>
      <MeasureUnitCode refname="MeasureUnitCode" shortname="c095">gr</MeasureUnitCode>
    </Measure>
    <SupplyDetail>
      <SupplierName refname="SupplierName" shortname="j137">Supplier Unknown</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">GB</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">43</ProductAvailability>
      <Price refname="Price" shortname="price">
        <PriceTypeCode refname="PriceTypeCode" shortname="j148">02</PriceTypeCode>
        <PriceAmount refname="PriceAmount" shortname="j151">0.50</PriceAmount>
        <CurrencyCode refname="CurrencyCode" shortname="j152">GBP</CurrencyCode>
        <TaxRateCode1 refname="TaxRateCode1" shortname="j153">Z</TaxRateCode1>
        <TaxRatePercent1 refname="TaxRatePercent1" shortname="j154">0.0</TaxRatePercent1>
        <TaxableAmount1 refname="TaxableAmount1" shortname="j155">0.50</TaxableAmount1>
        <TaxAmount1 refname="TaxAmount1" shortname="j156">0.00</TaxAmount1>
      </Price>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">72077</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">Eurospan Group Ltd</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">GB</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">117189</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">Antipodes Books and Beyond</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">US</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">120778</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">CSIRO Publishing</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">AU</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">114396</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">University and Reference Publishers' Services (UNIREPS)</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">AU</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">123799</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">Manaaki Whenua Press</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">NZ</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">114396</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">University and Reference Publishers' Services (UNIREPS)</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">NZ</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <SupplyDetail>
      <SupplierIdentifier refname="SupplierIdentifier" shortname="supplieridentifier">
        <SupplierIDType refname="SupplierIDType" shortname="j345">02</SupplierIDType>
        <IDTypeName refname="IDTypeName" shortname="b233">Nielsen BookData Org ID</IDTypeName>
        <IDValue refname="IDValue" shortname="b244">72077</IDValue>
      </SupplierIdentifier>
      <SupplierName refname="SupplierName" shortname="j137">Eurospan Group Ltd</SupplierName>
      <SupplierRole refname="SupplierRole" shortname="j292">00</SupplierRole>
      <SupplyToCountry refname="SupplyToCountry" shortname="j138">IE</SupplyToCountry>
      <ProductAvailability refname="ProductAvailability" shortname="j396">99</ProductAvailability>
      <UnpricedItemType refname="UnpricedItemType" shortname="j192">04</UnpricedItemType>
    </SupplyDetail>
    <MarketRepresentation>
      <AgentName refname="AgentName" shortname="j401">University and Reference Publishers' Services (UNIREPS)</AgentName>
      <AgentRole refname="AgentRole" shortname="j402">07</AgentRole>
      <MarketCountry refname="MarketCountry" shortname="j403">AU</MarketCountry>
    </MarketRepresentation>
  </Product>
 
Old March 27th, 2007, 02:15 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't know how you are transforming but with most processors, MSXML for instance, you can set resolveExternals to false, or some similar syntax. This way the DTD won't be retrieved and the defaults won't be added. Of course if you do this and you are are relying on the DTD to validate the structure of the document then you'll have to break it into two phases, one for validation and a separate one for transformation.

--

Joe (Microsoft MVP - XML)
 
Old March 27th, 2007, 02:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's not XSLT that adds the default attributes, it's the XML parser. That might not be much consolation: on the other hand, it points you to the right area to look for a solution. Some XML parsers may have options you can set to change this behaviour. In general, though, the easiest answer is to change the DTD or parse without one.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 27th, 2007, 04:20 PM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the reply mhkay and joefawcett.

I am using following VB.NET code for transformation. Please tell me where I can set flag for not to resolve externals.

Also, mhkay I can not modify source XML document to remove DOCType declaration and what do you mean by "parse without one".

Sub Main(ByVal args() As String)
        Dim xmlInputFile As String = args(0)
        Dim xslInputFile As String = args(1)
        Const xmlOutputFile As String = "output.xml"

        Dim xPathDoc As New XPathDocument(xmlInputFile)
        Dim transform As New XslCompiledTransform()
        Dim results As Stream = Nothing

        Try
            results = File.Create(xmlOutputFile)

            Dim argsList As New XsltArgumentList()
            Dim dateAndTime As New MyDateTime()
            argsList.AddExtensionObject("urn:MyDateTime", dateAndTime)

            transform.Load(xslInputFile)
            transform.Transform(xPathDoc, argsList, results)

        Catch ex As Exception
            results.Flush()
            Console.WriteLine(ex)
        Finally
            results.Close()
        End Try
    End Sub
 
Old March 28th, 2007, 03:31 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You can't do it directly from XPathDocument but if you first create an XmlTextReader this does not add default attributes and you then load XPathDocument with the reader.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Rows Based Upon Number of XML Attributes. Mr.T Infopath 0 November 5th, 2007 07:29 PM
Automated tool to convert XML from DTD to DTD lsantos2000 XSLT 2 October 17th, 2007 08:21 AM
transformation from attributes to nested elements e-bell XSLT 2 January 21st, 2007 07:21 PM
Which DTD? Snib HTML Code Clinic 2 July 16th, 2004 03:34 AM
Help with DTD P Keshav XML 1 September 12th, 2003 12:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.