I’m trying to understand this xslt.
What does the below xslt command select exactly? what are “following-sibling”, “aic” and “pstyle”?
“aic” seems to be a namespace.
What xml input the below xslt work with?
<xsl:stylesheet exclude-result-prefixes="aic"
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aic="http://ns.adobe.com/AdobeInCopy/2.0/" >
<xsl:template match="/">
<xsl:value-of select="following-sibling::aic:pstyle"/>
</xsl:template>
</xsl:stylesheet>
following-siblingis the axis, denoting which “direction” to look for nodes, in this case it looks at nodes which are after the current context node in document order but share the same parent as the current node. If you don’t specify an axis the default ischild, which looks for child nodes of the current context node.aic:pstyleis a selector that looks for elements whose local name ispstyleand whose namespace URI ishttp://ns.adobe.com/AdobeInCopy/2.0/(the one that is mapped to the prefixaicin the stylesheet).The source XML need not use the same prefix, e.g. the expression would match an element that looks like
or
in the original XML.
As JLRishe points out, this particular XPath will not match anything if the current context is the document node
/, for the expression to be meaningful it would have to be executed in a context where the current node is an element (or comment, processing instruction or text node) at least two levels down i.e. a child of the document element or deeper.If executed with the
fooelement as the context node, the expression would select pstyle elements 2 and 3, but not 1.