xsl-list
[Top] [All Lists]

AW: Processing an xml catalog in xslt

2004-06-29 05:25:44
hi,
as far as understand it after a quick read <rewriteURI> is in the 
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"

so you just need to declare a namespace preferably in the xsl:stylesheet 
elemment and match that (you needed the last one so you should use [last()] and 
not [1]?):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:cat="urn:oasis:names:tc:entity:xmlns:xml:catalog" version="1.0">
   <xsl:output method="text" indent="yes" encoding="UTF-8"/>
   <xsl:strip-space elements="*"/>
  
   <xsl:template match="cat:rewriteURI[last()]">
 <xsl:value-of select="concat('docbook.dtd.subroot=',@rewritePrefix)"/>
   </xsl:template>
  
</xsl:stylesheet>

you even could put the default namespace of the stylesheet to 
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog", and then 
match="rewriteURI" should just work. 


did you mean that?
chris


-----Ursprüngliche Nachricht-----
Von: Nicolas Mailhot [mailto:Nicolas(_dot_)Mailhot(_at_)laPoste(_dot_)net]
Gesendet: Dienstag, 29. Juni 2004 14:04
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] Processing an xml catalog in xslt


Hi all,

I currently need to feed an xml catalog to a java process that is too
dumb to process it. So I was thinking of extracting the values I need
into a stupid property file using an xsl.

The problem is, I've never processed a file with such a complex
namespace as this xml catalog, and I'm failing miserably. The catalog
file looks like this :

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog
V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <public publicId="ISO 8879:1986//ENTITIES Publishing//EN" uri="xml-
dtd-4.2-1.0-24/ent/iso-pub.ent"/>

[...]

<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.2";
rewritePrefix="xml-dtd-4.2-1.0-24"/>
</catalog>

All I need basically right now is the value of rewritePrefix for this
last entry. The best solution I've found now is

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:output method="text" indent="yes" encoding="UTF-8"/>
  <xsl:strip-space elements="*"/>
 
  <xsl:template match="*
[(_at_)uriStartString='http://www.oasis-open.org/docbook/xml/4.2'][1]">
<xsl:value-of select="concat('docbook.dtd.subroot=',@rewritePrefix)"/>
  </xsl:template>
 
</xsl:stylesheet>

But I don't like much to use a * to match rewriteURI. However so far I
didn't manage to replace it with something that still works. 
Anyone got
a better solution ?

Regards,

-- 
Nicolas Mailhot


--+------------------------------------------------------------------
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>