From: Filipe MS B. (UA) <fs...@ua...> - 2013-03-01 19:33:29
|
Hi Demian, good morning. Thanks for the prompt confirmation (and this time delivered quickly as it should [and if you've replied to my message, I guess it has already been delivered :) ] ! All the best, Filipe -----Original Message----- From: Demian Katz [mailto:dem...@vi...] Sent: sexta-feira, 1 de Março de 2013 12:24 To: Filipe MS Bento (UA); David Maus; Osullivan L. Cc: vuf...@li... Subject: RE: [VuFind-Tech] Mailing list weirdness [was: OAI / XSL] Filipe, Some of my messages from yesterday took an unusually long time to reach the mailing list, but the situation seems better this morning... and obviously I am receiving your messages! - Demian ________________________________________ From: Filipe MS Bento (UA) [fs...@ua...] Sent: Friday, March 01, 2013 7:18 AM To: David Maus; Osullivan L. Cc: vuf...@li...; Demian Katz Subject: RE: [VuFind-Tech] OAI / XSL Hi Luke / David, all! Actually immediately after sending my message (copy bellow David's one), even if for VuFind ingest / import purposes the namespace is not relevant as what it counts is " xmlns:php="http://php.net/xsl" and the generated XML does not have anything to do with rfc1807 (please correct me if I'm wrong --- also the URL for that namespace is redirecting for a 404 [not found] page -> should be http://www.openarchives.org/OAI/1.1/rfc1807.xsd), it does not hurt to have it there as I was going to suggest and David sent, instead of " xmlns:a", " xmlns:xyz" or " xmlns:xpto". Btw: strange things are happening with this ML: even if I've only checked my e-mail at around midnight (tried to recreate the problem and find a solution immediately after), in my mailbox appears as it has been sent at 10pm (and not 2pm), but when replying it appears 2pm. And also, I've replied at 1.20am, but just received a copy from the ML at 2am (more than half-hour later). Can someone confirm this behavior (or is it a local problem of mine)? And also if you are receiving my messages, please. Thanks. Warm wishes / have a nice weekend, Filipe -----Original Message----- From: David Maus [mailto:ma...@ha...] Sent: sexta-feira, 1 de Março de 2013 10:54 To: Osullivan L. Cc: vuf...@li... Subject: Re: [VuFind-Tech] OAI / XSL At Thu, 28 Feb 2013 14:20:28 +0000, Osullivan L. wrote: > > [1 <multipart/alternative (7bit)>] > [1.1 <text/plain; iso-8859-1 (quoted-printable)>] > > [1.2 <text/html; iso-8859-1 (quoted-printable)>] "tty" option > detected in CYGWIN environment variable. > CYGWIN=tty is no longer supported. Please remove it from your CYGWIN > environment variable and use a terminal emulator like mintty, xterm, > or rxvt. > Hi Folks, > > I'm trying to ingest some xml files obtained via OAI and I'm running into a few problems with the xsl tranformations. > > The xml is quite simple: > > <rfc1807 > xmlns="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt http:// www.openarchives.org/OAI/1.1/rfc1807.xsd"> > <bib-version>v2</bib-version> > <id>9</id> > <entry>2011-10-01</entry> > <title>Write now!</title> > <author>Harold Thimbleby</author> > <date>2011-10-01</date> > </rfc1807> > > And here is the xsl: > > <!-- available fields are defined in solr/biblio/conf/schema.xml --> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:php="http://php.net/xsl" > xmlns:rfc1807="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"> > <xsl:output method="xml" indent="yes" encoding="utf-8"/> > <xsl:param name="institution">Swansea University</xsl:param> > <xsl:param name="collection">RIS</xsl:param> > <xsl:template match="/"> > <add> > <doc> > <field name="id"> > <xsl:value-of select="id"/> > </field> > </doc> > </add> > </xsl:template> > </xsl:stylesheet> > > For some reason, <xsl:template match="rfc1807"> results in an > outputted file with all the text but none of the tags (even <add> and > <doc> are missing. I have tried using //id as the selector but that > doesn't work either. The only way I can get it to work is to remove > the xmlns from the <rfc1807> root element in the xml file. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:rfc1807="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:param name="institution">Swansea University</xsl:param> <xsl:param name="collection">RIS</xsl:param> <xsl:template match="rfc1807:rfc1807"> <add> <doc> <field name="id"> <xsl:value-of select="rfc1807:id"/> </field> </doc> </add> </xsl:template> </xsl:stylesheet> <rfc1807 xmlns="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt" .> Defines the default namespace (=for elements without a prefix) to be `http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt'. Every element that does not have a prefix is an element from this namespace. If you define an different prefix for the namespace in the XSL transformation you must use the prefix when matching nodes. The full-qualified name of an element consists of the element's namespace and the name of it's tag and you normally match elements in XSL by their full-qualified name. > outputted file with all the text but none of the tags XSL applies an default template for text nodes that where not matched in the run and simply spits them out. To avoid them define a template that overrides this behavior: <xsl:template match="text()"/> Best, -- David ---------------------- From: Filipe MS Bento (UA) [mailto:fs...@ua...] Sent: sexta-feira, 1 de Março de 2013 01:22 To: Osullivan L.; vuf...@li... Subject: Re: [VuFind-Tech] OAI / XSL Hi Luke, hi all! It took several trials because it's been a while since I've dealt with this kind of stuff, but it all came back to me for a last attempt, working one, when stopped for a second and tried to remember how namespaces in XSLT work (basically I would say it works like arguments being passed and invoked inside functions or at least is the perception that I have from a trial-error basis knowledge acquired). And here you go: ---- <!-- available fields are defined in solr/biblio/conf/schema.xml --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:a="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:param name="institution">Swansea University</xsl:param> <xsl:param name="collection">RIS</xsl:param> <xsl:template match="a:rfc1807"> <add> <doc> <field name="id"> <xsl:value-of select="a:id"/> </field> </doc> </add> </xsl:template> </xsl:stylesheet> --- xmlns:a could be xmlns:xyz, xmlns:xpto :) or whatever: --- <!-- available fields are defined in solr/biblio/conf/schema.xml --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:xpto="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:param name="institution">Swansea University</xsl:param> <xsl:param name="collection">RIS</xsl:param> <xsl:template match="xpto:rfc1807"> <add> <doc> <field name="id"> <xsl:value-of select="xpto:id"/> </field> </doc> </add> </xsl:template> </xsl:stylesheet> --- the output will be: <?xml version="1.0" encoding="utf-8"?> <add xmlns:php="http://php.net/xsl" xmlns:xpto="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"> <doc> <field name="id">9</field> </doc> </add> --- and better yet: Successfully imported test.xml... All the best ("write to you" later, next DC, if not before), Filipe ____________________________________________ Filipe Manuel S. Bento | http://about.filipebento.pt/ ICPD Doctorate Candidate (UA | U.Porto) * PhD Researcher (UA/CETAC.Media), grant by FCT - Portuguese Foundation for Science and Technology Chairman of USE.pt Management Board (Portuguese Ex Libris Users' National Association, hosted by Portuguese Parliament, Palácio de S. Bento, Lisbon, http://www.USEpt.org) > > Can anyone offer any pointers? > > Cheers, > > Luke > > -- > Luke O'Sullivan > Systems Developer > Web Team > Swansea University, Singleton Park, Swansea SA2 8PP, UK > l.o...@sw... > 01792 602772 > @l_os_cymru > > > [2 <text/plain; us-ascii (7bit)>] > ---------------------------------------------------------------------- > -------- Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics Download AppDynamics Lite > for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > [3 <text/plain; us-ascii (7bit)>] > _______________________________________________ > Vufind-tech mailing list > Vuf...@li... > https://lists.sourceforge.net/lists/listinfo/vufind-tech ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Vufind-tech mailing list Vuf...@li... https://lists.sourceforge.net/lists/listinfo/vufind-tech |