[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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="* [@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|