add a new element into an xml file with the same namespace
Are you missing a feature? Request its implementation here.
add a new element into an xml file with the same namespace
Post by Guest »
hi,
I have a big problem and I hope that someone could help me.
if an element isn't present into the xml file, I want insert it.
The xsl to trasform the xml is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="">
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="c:Insinuazione" xmlns:c="http://www.giustizia.it/Concorsuali/StatoPassivo">
<xsl:copy>
<xsl:if test="count(c:NumeroInsinuazione)=0">
<xsl:element name="NumeroInsinuazione"/>
</xsl:if>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:stylesheet>
if NumeroInsinuazione is not in the xml, the xsl trasfom it adding the element.
The problem is that I want that the new element takes the same namespace suffix of the source xml, otherwise I can't validate it.
Is it possible to do it?
best regards
I have a big problem and I hope that someone could help me.
if an element isn't present into the xml file, I want insert it.
The xsl to trasform the xml is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="">
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="c:Insinuazione" xmlns:c="http://www.giustizia.it/Concorsuali/StatoPassivo">
<xsl:copy>
<xsl:if test="count(c:NumeroInsinuazione)=0">
<xsl:element name="NumeroInsinuazione"/>
</xsl:if>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:stylesheet>
if NumeroInsinuazione is not in the xml, the xsl trasfom it adding the element.
The problem is that I want that the new element takes the same namespace suffix of the source xml, otherwise I can't validate it.
Is it possible to do it?
best regards
hi george,
I was in holiday and now I started again with the same problem.
thanks for your help. I have tried your solution and works correctly and the validation finish fine, but I am using the xml that I have got from the transformation in a oracle XMLType to update the value of NumeroInsinuazione, so if the element is for example <n:NumeroInsinuazione> the update function of the xmltype finds the element, but if the element is <NumeroInsinuazione + namespace> the update function doesn't find the element and I can't assign a value to it.
If you know something to avoid this problem, please tell me.
In each case thanks for your help.
I hope my english is enough correct and unintelligible.
best regard
ciccio
I was in holiday and now I started again with the same problem.
thanks for your help. I have tried your solution and works correctly and the validation finish fine, but I am using the xml that I have got from the transformation in a oracle XMLType to update the value of NumeroInsinuazione, so if the element is for example <n:NumeroInsinuazione> the update function of the xmltype finds the element, but if the element is <NumeroInsinuazione + namespace> the update function doesn't find the element and I can't assign a value to it.
If you know something to avoid this problem, please tell me.
In each case thanks for your help.
I hope my english is enough correct and unintelligible.
best regard
ciccio
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service