Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] xmlns (flawed XML?) (edited)

From: "M. David Peterson" <m.david@---------->
To:
Date: 6/2/2004 3:25:00 AM
It occurred to me that it would probably be helpful to see what a template 
looks like that would work for this XML...

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:s="http://www.loc.gov/MARC21/slim"
                version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
  <xsl:apply-templates select="//s:subfield[@code = 'a']"/>
</xsl:template>
<xsl:template match="s:subfield">
  <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

Notice the namespace declaration for s... 
xmlns:s="http://www.loc.gov/MARC21/slim"

Hope this helps!

<M:D/>


----- Original Message ----- 
From: "M. David Peterson" <m.david@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, June 02, 2004 9:04 AM
Subject: Re: [xsl] xmlns (flawed XML?) (edited)


> Hey Mike,
>
> Looks like a namespace issue.  What you think you are able to access using 
> "record/datafield" will return nothing.  You can prove this by taking your 
> default namespace out or properly referencing your namespace in your XSLT 
> (e.g. "s:record/s:datafield").  Without XSLT its tought to say for sure 
> but this is usually the scenario in cases where there is a default 
> namespace used in the XML.
>
> If this isnt the case let us know and we can help you further...
>
> Best of luck!
>
> <M:D/>
>
>
> ----- Original Message ----- 
> From: "Mike Ferrando" <mikeferrando@xxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, June 02, 2004 8:27 AM
> Subject: [xsl] xmlns (flawed XML?) (edited)
>
>
> > Friends,
> > [The last e-mail I sent had an example with more than one record (XML
> > document) in it. Sorry.]
> >
> > I am having trouble trying to figure out why I cannot seem to write a
> > stylesheet for this XML document.
> >
> > I suspect that the XML is not correct.
> >
> > Please take a look at it (below).
> >
> > My hunch is that it needs one or both of the following:
> >   i) DOCTYPE statement pointing to a Schema or a DTD
> >   ii) namespace prefix for the elements.
> >
> > Mike Ferrando
> > Washington, DC
> >
> > ===XML:===
> > <record xmlns="http://www.loc.gov/MARC21/slim">
> >   <leader>01248cam  2200277 a 4500</leader>
> >   <controlfield tag="001">12655819  </controlfield>
> >   <controlfield tag="005">20030723214400.0  </controlfield>
> >   <controlfield tag="008">020125s2002    enkab    b    001 0 eng
> > </controlfield>
> >   <datafield tag="906" ind1=" " ind2=" ">
> >     <subfield code="a">7</subfield>
> >     <subfield code="b">cbc</subfield>
> >     <subfield code="c">orignew</subfield>
> >     <subfield code="d">1</subfield>
> >     <subfield code="e">ecip</subfield>
> >     <subfield code="f">20</subfield>
> >     <subfield code="g">y-gencatlg</subfield>
> >   </datafield>
> >   <datafield tag="925" ind1="0" ind2=" ">
> >     <subfield code="a">acquire</subfield>
> >     <subfield code="b">2 shelf copies</subfield>
> >     <subfield code="x">policy default</subfield>
> >   </datafield>
> >   <datafield tag="955" ind1=" " ind2=" ">
> >     <subfield code="a">yh55 2002-01-25</subfield>
> >     <subfield code="c">yh55 2002-01-25</subfield>
> >     <subfield code="d">yh45 2002-01-25</subfield>
> >     <subfield code="e">yh31 2002-01-28 to Dewey</subfield>
> >     <subfield code="a">aa19 2002-01-28</subfield>
> >     <subfield code="a">ps16 2002-05-10 bk rec&apos;d, to CIP
> > ver.</subfield>
> >     <subfield code="f">yg03 2002-05-13 to BCCD</subfield>
> >     <subfield code="e">yk12 2002-06-06 Copy 2 to BCCD</subfield>
> >   </datafield>
> >   <datafield tag="010" ind1=" " ind2=" ">
> >     <subfield code="a">  2002001234</subfield>
> >   </datafield>
> >   <datafield tag="020" ind1=" " ind2=" ">
> >     <subfield code="a">0195145135</subfield>
> >   </datafield>
> >   <datafield tag="040" ind1=" " ind2=" ">
> >     <subfield code="a">DLC</subfield>
> >     <subfield code="c">DLC</subfield>
> >     <subfield code="d">DLC</subfield>
> >   </datafield>
> >   <datafield tag="042" ind1=" " ind2=" ">
> >     <subfield code="a">pcc</subfield>
> >   </datafield>
> >   <datafield tag="043" ind1=" " ind2=" ">
> >     <subfield code="a">f-ae---</subfield>
> >   </datafield>
> >   <datafield tag="050" ind1="0" ind2="0">
> >     <subfield code="a">DT295</subfield>
> >     <subfield code="b">.C6115 2002</subfield>
> >   </datafield>
> >   <datafield tag="082" ind1="0" ind2="0">
> >     <subfield code="a">965/.0462</subfield>
> >     <subfield code="2">21</subfield>
> >   </datafield>
> >   <datafield tag="100" ind1="1" ind2=" ">
> >     <subfield code="a">Connelly, Matthew James.</subfield>
> >   </datafield>
> >   <datafield tag="245" ind1="1" ind2="2">
> >     <subfield code="a">A diplomatic revolution :</subfield>
> >     <subfield code="b">Algeria&apos;s fight for independence and the
> > origins of the post-cold war era /</subfield>
> >     <subfield code="c">Matthew Connelly.</subfield>
> >   </datafield>
> >   <datafield tag="246" ind1="3" ind2="0">
> >     <subfield code="a">Algeria&apos;s fight for independence and the
> > origins of the post-cold war era</subfield>
> >   </datafield>
> >   <datafield tag="260" ind1=" " ind2=" ">
> >     <subfield code="a">Oxford ;</subfield>
> >     <subfield code="a">New York :</subfield>
> >     <subfield code="b">Oxford University Press,</subfield>
> >     <subfield code="c">2002.</subfield>
> >   </datafield>
> >   <datafield tag="300" ind1=" " ind2=" ">
> >     <subfield code="a">xviii, 400 p. :</subfield>
> >     <subfield code="b">ill., maps ;</subfield>
> >     <subfield code="c">24 cm.</subfield>
> >   </datafield>
> >   <datafield tag="504" ind1=" " ind2=" ">
> >     <subfield code="a">Includes bibliographical references (p.
> > 361-385) and index.</subfield>
> >   </datafield>
> >   <datafield tag="651" ind1=" " ind2="0">
> >     <subfield code="a">Algeria</subfield>
> >     <subfield code="x">History</subfield>
> >     <subfield code="y">Revolution, 1954-1962.</subfield>
> >   </datafield>
> >   <datafield tag="856" ind1="4" ind2="2">
> >     <subfield code="3">Book review (H-Net)</subfield>
> >     <subfield
> > code="u">http://www.h-net.org/review/hrev-a0c5n4-aa</subfield>
> >   </datafield>
> > </record>
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Friends.  Fun.  Try the all-new Yahoo! Messenger.
> > http://messenger.yahoo.com/
> >
> > --+------------------------------------------------------------------
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> > or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> > --+--
> >
>
> --+------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent