xsl-list
[Top] [All Lists]

Re: xmlns (flawed XML?) (edited)

2004-06-02 08:25:10
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[(_at_)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(_dot_)david(_at_)mdptws(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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(_at_)yahoo(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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(_at_)lists(_dot_)mulberrytech(_dot_)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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



<Prev in Thread] Current Thread [Next in Thread>