G
gimme_this_gimme_that
I have the following xml file and need some tips on xpath queries to
fetch the data.
I think I'm not handling namespaces correctly.
Here is xml file :
<?xml version="1.0" encoding="UTF-8"?>
<epi:component build-version="Gold"
component-id="sss0005style0001"
component-type="Grids"
description="Grid that has 3 columns."
epi-build="105"
epi-version="7.1"
major-version="1"
minor-version="0"
title="Default Title"
xmlns:epi="http://www.epicentric.com/deployment">
<epi:required-component component-id="template0005"
component-type="Style Types"
major-version="7"
minor-version="1"
/>
<epi:detail>
<style-info apply-template-header="true"
description="A description."
friendly-id="sss_grid.default"
id="sss0005style0001"
is-system="false"
primary-filename="sss-grid-default.jsp"
processing-type="JSP_BASED"
template-default="false"
template-uid="template0005"
title="SPS Default Grid"
visible="true"
/>
</epi:detail>
</epi:component>
I've been testing the XPath queries using transforms via xalan. Here is
the xsl :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:epi="http://www.epicentric.com/deployment">
<xsl:template match="/">
<xsl:value-of select="//style-info[@description]"/>
<xsl:value-of select="//epi:component[@build-version]"/>
</xsl:template>
</xsl:stylesheet>
Questions :
1. <xsl:value-of select="//style-info[@description]"/> doesn't return
anything.
What expression returns "A description" ?
Is there a fully qualified expression returning the same value? Like
"//epi:component/epi:detail/style-info[@description]".
2. <xsl:value-of select="//epi:component[@build-version]"/>
What expression returns "Gold" ?
fetch the data.
I think I'm not handling namespaces correctly.
Here is xml file :
<?xml version="1.0" encoding="UTF-8"?>
<epi:component build-version="Gold"
component-id="sss0005style0001"
component-type="Grids"
description="Grid that has 3 columns."
epi-build="105"
epi-version="7.1"
major-version="1"
minor-version="0"
title="Default Title"
xmlns:epi="http://www.epicentric.com/deployment">
<epi:required-component component-id="template0005"
component-type="Style Types"
major-version="7"
minor-version="1"
/>
<epi:detail>
<style-info apply-template-header="true"
description="A description."
friendly-id="sss_grid.default"
id="sss0005style0001"
is-system="false"
primary-filename="sss-grid-default.jsp"
processing-type="JSP_BASED"
template-default="false"
template-uid="template0005"
title="SPS Default Grid"
visible="true"
/>
</epi:detail>
</epi:component>
I've been testing the XPath queries using transforms via xalan. Here is
the xsl :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:epi="http://www.epicentric.com/deployment">
<xsl:template match="/">
<xsl:value-of select="//style-info[@description]"/>
<xsl:value-of select="//epi:component[@build-version]"/>
</xsl:template>
</xsl:stylesheet>
Questions :
1. <xsl:value-of select="//style-info[@description]"/> doesn't return
anything.
What expression returns "A description" ?
Is there a fully qualified expression returning the same value? Like
"//epi:component/epi:detail/style-info[@description]".
2. <xsl:value-of select="//epi:component[@build-version]"/>
What expression returns "Gold" ?