Hier ist ein trivial, aber gültig Docbook Artikel:XPath-Auswahl auf Elemente mit Namespaces
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<title>I Am Title</title>
<para>I am content.</para>
</article>
Hier ist ein Stylesheet, das title
wählt, wenn ich die xmlns
entfernen oben Attribut, und nicht, ob ich überlasse es in:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="article"/>
</xsl:template>
<xsl:template match="article">
<p><xsl:value-of select="title"/></p>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
Wie spreche ich XPath in Auswahl title
durch article
, wenn es dieses Namespace-Attribut hat?
See [diese Frage] (http://stackoverflow.com/questions/103576/whats-wrong-with- my-xpath-xml) – ripper234